I receive an error when running the following code. It throws an error when i try to set the parameters on the report. I looked everywhere but cannot seem to find an answer what I am doing wrong here. Every example has this method to pass parameters. Any insight would be greatly appreciated.
Me.ReportViewer1.Clear()
Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "Stock_Centric.OrderPrint.rdlc"
Me.ReportViewer1.LocalReport.DataSources.Clear()
Me.ReportViewer1.LocalReport.DataSources.Add(NewMicrosoft.Reporting.WinForms.ReportDataSource("dsOrderItems", dtItems.DefaultView))
Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
Dim paramtr(4) As ReportParameter
paramtr(0) = New ReportParameter("Type", "Sale")
paramtr(1) = New ReportParameter("Company", "Jabu")
paramtr(2) = New ReportParameter("Direction", "Out")
paramtr(3) = New ReportParameter("OrderNum", "53")
paramtr(4) = New ReportParameter("Reference", "Kukashop 123")
ReportViewer1.LocalReport.SetParameters(paramtr)
Me.ReportViewer1.RefreshReport()
Error: System.InvalidCastException: 'Unable to cast object of type 'Microsoft.Reporting.WebForms.ReportParameter[]' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WinForms.ReportParameter]'.'
All your parameters are in a form of strings?
Related
I'm using EF Core 2.1 and i have a Model SettingInformation. The SettingInformation has a Property Setting As ICollection(Of Setting).
The Setting Property has several Properties like Client As Client, User as User and also Workspace As Workspace. It's a bit complicated. Please see the Attached Diagram-Image.
Model-Diagram(Part of it)
Now i have the problem, that i'd like to get the complete Information of a Settinginformation.
The following code i have to get all Informations of a SettingInformation
Public Async Function GetCompleteSettingInformations(settingInfoId As Integer) As Task(Of SettingInformation)
Dim q As IQueryable(Of SettingInformation) = GetSettingInfoDefaultQuery()
q = q.Where(Function(s) s.SettingInformationId = settingInfoId)
q = q.Include(Function(i) i.Settings).ThenInclude(Function(i) i.User) _
.Include(Function(i) i.Settings).ThenInclude(Function(i) i.Workspace) _
.Include(Function(i) i.Settings).ThenInclude(Function(i) i.Client) _
.Include(Function(i) i.Protocol)
Dim ret = Await q.SingleOrDefaultAsync
Return ret
End Function
OK, this code works, but now i'd like to refactor this, because for example, I do not need the UserImage or the 'FailedLogins' of User when the 'LinkedToUser' Property of 'Protocol' is not nothing.
What i needed:
The complete 'SettingInformation' - OK easy
The 'Settings' From 'SettingInformation' (ICollection) - OK i can get this with the Include but in 'Settings':
only the 'UserName', 'FirstName' and 'LastName' from 'User' if 'User' is not Nothing
only the 'ClientShortName' and 'ClientLongName' of 'LinkedToClient' if 'Client is not Nothing
only the 'WorkspaceName' and 'WorkspaceLocation' of 'Workspace' id the 'Workspace' is not Nothing.
I hope so here is anybody who can help me to optimize this Query because now i also cat for example the UserImage for each Setting and this results in a long loadingtime.
EDIT:
OK, now i have tried to do that with EagerLoading. But the Select is ignored. But why? the following code:
'Alle WorkspaceIDs ermitteln für welche es Settingmodifikationen gibt
Dim wsIds As List(Of Integer) = ret.Settings.Where(Function(u) u.WorkspaceId.HasValue).Select(Function(u) u.WorkspaceId.Value).ToList
Await ContextInternal.Workspaces.Where(Function(u) wsIds.Contains(u.WorkspaceId)) _
.Select(Function(su) New Workspace() With {.WorkspaceName = su.WorkspaceName, .WorkspaceLocation = su.WorkspaceLocation, .WorkspaceDesciption = su.WorkspaceDesciption, .WorkspaceId = su.WorkspaceId, .Settings = su.Settings}).AsTracking.LoadAsync
Loads all workspaces that are related in Protocols. I will only get the columns ID, Description, Location and Name. But i get ALL Columns?
The following SQL is generated:
SELECT [u].[WorkspaceId],
[u].[CreatedBy],
[u].[CreatedOn],
[u].[CreationTimestamp],
[u].[DeletedFlag],
[u].[DeletedTimestamp],
[u].[LastUpdateBy],
[u].[LastUpdateOn],
[u].[LastUpdateTimestamp],
[u].[WorkspaceDesciption],
[u].[WorkspaceLastOnline],
[u].[WorkspaceLocation],
[u].[WorkspaceLocked],
[u].[WorkspaceName]
FROM [Workspaces] AS [u]
WHERE [u].[WorkspaceId] IN (1)
ORDER BY [u].[WorkspaceId]
I'm sending a variable called apiID from a tornado/jinja2 python file to my vuejs template like this:
class SmartAPIUIHandler(BaseHandler):
def get(self, yourApiID):
doc_file = "smartapi-ui.html"
dashboard_template = templateEnv.get_template(doc_file)
dashboard_output = dashboard_template.render(apiID = yourApiID )
self.write(dashboard_output)
then in vuejs I'm interpolating the variable with no problem except it gives me an error
it says: Uncaught SyntaxError: Invalid or unexpected token
I checked on the python handler file and apipID is a string, so I don't see the problem. I'm quite new to python so maybe the answer is more obvious to one of you. I appreciate the help!!
Because of dashboard_output = dashboard_template.render(apiID = yourApiID ), you must have, in your template, something around the code:
this.apiID = {{ apiID }};
Due to the value being not a number but a string, add the 's:
this.apiID = '{{ apiID }}';
I'm trying to generate a PDF file using Zend but I keep getting errors when trying to set the font.
Here is my code:
$pdf = new Zend_Pdf();
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
$font = new Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->setFont($font,24)
->drawText("Hello world!",72,720);
$pdf->$page;
$pdf->save("example.pdf");
And this is the error:
Parse error: syntax error, unexpected 'fontWithName' (T_STRING), expecting variable (T_VARIABLE) or '$' in /Users/pawel/Sites/Zend/application/modules/default/controllers/IndexController.php on line 83
I think you can just remove new for the font declaration:
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$style = new Zend_Pdf_Style();
$style->setFont($font, 24);
$page->setStyle($style);
fontWithName is a static function and Zend_Pdf_Font is an abstract class.
See the documentation for example.
There is another problem:
Replace
$pdf->$page;
by
$pdf->pages[] = $page;
I have a dnn 7.2.2 development site running under dnndev.me on my local machine. I have created a simple product catalogue module and am trying to integrate the new search for dnn 7.
Here is the implementation of ModuleSearchBase in my feature/business controller
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Globals
Namespace Components
Public Class FeatureController
Inherits ModuleSearchBase
Implements IUpgradeable
Public Overrides Function GetModifiedSearchDocuments(moduleInfo As ModuleInfo, beginDate As Date) As IList(Of Entities.SearchDocument)
Try
Dim SearchDocuments As New List(Of Entities.SearchDocument)
'get list of changed products
Dim vc As New ViewsController
Dim pList As List(Of vw_ProductList_Short_Active) = vc.GetProduct_Short_Active(moduleInfo.PortalID)
If pList IsNot Nothing Then
''for each product, create a searchdocument
For Each p As vw_ProductList_Short_Active In pList
Dim SearchDoc As New Entities.SearchDocument
Dim ModID As Integer = 0
If p.ModuleId Is Nothing OrElse p.ModuleId = 0 Then
ModID = moduleInfo.ModuleID
Else
ModID = p.ModuleId
End If
Dim array() As String = {"mid=" + ModID.ToString, "id=" + p.ProductId.ToString, "item=" + Replace(p.Name, " ", "-")}
Dim DetailUrl = NavigateURL(moduleInfo.TabID, GetPortalSettings(), "Detail", array)
With SearchDoc
.AuthorUserId = p.CreatedByUserId
.Body = p.ShortInfo
.Description = p.LongInfo
.IsActive = True
.PortalId = moduleInfo.PortalID
.ModifiedTimeUtc = p.LastUpdatedDate
.Title = p.Name + " - " + p.ProductNumber
.UniqueKey = Guid.NewGuid().ToString()
.Url = DetailUrl
.SearchTypeId = 2
.ModuleId = p.ModuleId
End With
SearchDocuments.Add(SearchDoc)
Next
Return SearchDocuments
Else
Return Nothing
End If
Catch ex As Exception
LogException(ex)
Return Nothing
End Try
End Function
End Class
End Namespace
I cleared the site cache and then I manually started a search re-index. I can see from the host schedule history that the re-index is run and completes.
PROBLEM
None of the items in the above code are added to the index. I even used the Luke Inspector to look into the lucene index and that confirms that these items are not added.
QUESTION
I need help figuring out why these items are not getting added or I need help on how to debug the indexing to see if anything is going run during that process.
Thanks in Advance
JK
EDIT #1
I ran the following procedure in Sql Server to see if the module is even listed in the search modules:
exec GetSearchModules[PortalId]
The module in question does appear in this list. The indexing is called for the featureController, but the results are not added to the lucene index. Still need help.
EDIT #2
So I upgraded to 7.3.1 in the hopes that something during the installation would fix this issue. But it did not. The search documents are still getting created/ returned by the GetModifiedSearchDocuments function but the documents are not being added to the Lucene index and therefore do not appear in the search results.
EDIT #3
The break point is not getting hit like i thought after the upgrade, but I added a try catch to log exceptions and the following error log is getting created when I try to manually re-index (cleaned up to keep it short)
AssemblyVersion:7.3.1
PortalID:-1
PortalName:
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:d0a443da-3d68-4b82-afb3-8c9183cf8424
InnerException:Sequence contains more than one matching element
Method:System.Linq.Enumerable.Single
StackTrace:
Message:
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.LoadQueueFromTimer()
at DotNetNuke.Services.Scheduling.Scheduler.CoreScheduler.Start()
Source:
Server Name: KING-PC
EDIT #4
Okay, I fixed the problem in edit three following This Disucssion on the DNN issue tracker, but still no items being added to the lucene index.
The breakpoint is hit, and once i leave the debugger running for a while i get the following error:
{"Exception of type 'Lucene.Net.Index.MergePolicy+MergeException' was
thrown."} {"Cannot overwrite:
C:\websites\dnndev.me\App_Data\Search\_1f0.fdt"}
Looks like a permission error. I'll see what I can work out
J King,
I just finished a series on DNNHero.com on Implementing Search in your Module. Parts 3 and 4 are implementing and debugging your ModuleSearchBase implementation.
EDIT: Remove your assignment to the SearchTypeId in your implementation
Also, here is a sample snippet to see how i am setting the attributes of the SearchDocument. Again, watch my video for a whole bunch of other potential pitfalls in the Search implementation.
SearchDocument doc = new SearchDocument
{
UniqueKey = String.Format("{0}_{1}_{2}",
moduleInfo.ModuleDefinition.DefinitionName, moduleInfo.PortalID, item.ItemId),
AuthorUserId = item.AssignedUserId,
ModifiedTimeUtc = item.LastModifiedOnDate.ToUniversalTime(),
Title = item.ItemName,
Body = item.ItemDescription,
Url = "",
CultureCode = "en-US",
Description = "DotNetNuclear Search Content Item",
IsActive = true,
ModuleDefId = moduleInfo.ModuleDefID,
ModuleId = item.ModuleId,
PortalId = moduleInfo.PortalID,
TabId = tab
};
I'm trying to use the SqlFileStream object in a WCF service to get a handle to a specific file that is in a SQL Server 2012 FileTable. I'm able to get the path and transaction context like you would expect with no issues using this piece of code:
using (SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["FileStorage"].ConnectionString))
{
con2.Open();
string getFileHandleQuery = String.Format(
#"SELECT FileTableRootPath(), file_stream.GetFileNamespacePath(), GET_FILESTREAM_TRANSACTION_CONTEXT()
FROM {0}
WHERE stream_id = #streamId", "FSStore");
byte[] serverTransactionContext;
string serverPath;
using (SqlCommand sqlCommand = new SqlCommand(getFileHandleQuery, con2))
{
sqlCommand.Parameters.Add("#streamId", SqlDbType.UniqueIdentifier).Value = new Guid(finalFileHandleStreamId);
using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
{
sqlDataReader.Read();
serverPath = String.Concat(sqlDataReader.GetSqlString(0).Value, sqlDataReader.GetSqlString(1).Value);
serverTransactionContext = sqlDataReader.GetSqlBinary(2).Value;
sqlDataReader.Close();
}
}
con2.Close();
}
However, once I try and actually use the path and transaction context to create a new SqlFileStream:
using (SqlFileStream dest =
new SqlFileStream(serverPath, serverTxn, FileAccess.Write))
{
...
}
The above blows ups with the following exception: The mounted file system does not support extended attributes.
Can someone please explain to me what I'm doing wrong here?
Thanks!
If you are trying to use FileTable and receive an error when new a SqlFileStream object, please check the filePath value.
SqlFileStream sfs = new SqlFileStream(filePath, objContext, System.IO.FileAccess.Read); <-- Error "The mounted file system does not support extended attributes"
Correct way to obtain the filePath value is
SELECT [file_stream].PathName() FROM dbo.fTable WHERE name = 'test.xlsx'
filePath value should look like:
\\HOSTNAME\MSSQLSERVER\v02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593\test\dbo\fTable\file_stream\A654465D-1D9F-E311-B680-00155D98CA00\VolumeHint-HarddiskVolume1
not like:
\\HOSTNAME\MSSQLSERVER\Store\fDirectory\test.xlsx
That is required by design. Please refer to
https://connect.microsoft.com/SQLServer/feedback/details/729273/sql-server-denali-filetable-access-using-sqlfilestream-returns-error-the-mounted-file-system-does-not-support-extended-attributes
and
Access FILESTREAM Data with OpenSqlFilestream
http://technet.microsoft.com/en-us/library/bb933972.aspx