在 VB.net 报告中使用基本功能(例如 overallpagenumber)时出现异常
Exception by using basic functionality (e.g. overallpagenumber) in VB.net Report
我将在我的 VB.net-应用程序 (VS2015) 中创建报告 (Link)。为此,我将一些自己的 objects/classes 作为数据源绑定到本地报告。我还将这些 classes 作为数据源插入到 RDLC 报告中。然后我在报告中使用这些 classes 的数据,例如在 table 或文本框中。当我启动我的应用程序并创建报告时。一切正常。来自我的 class 实例的数据被放置在报告中。伟大的!
(PS:用到的class在单独的DLL里面,是我自己写的。)
那我就把我的报告写得漂亮一点。我添加了一个页眉,并在其中放置了一个带有当前页码的文本框。 (从报表数据视图拖放)
之后我想重新启动我的应用程序,但出现错误。我删除了文本框 >> 没有错误。我再次插入带有 "overpagenumber" 的文本框 >> 错误!
但是报错说:他找不到我的DLL(=S88Model)。 (错误消息已翻译)
Error loading the code module: 'S88Model, version=1.0.0.0,
Culture=neutral, PublicKeyToken=null'. Details: The file or assembly
"S88Model, Version=1.0.0.0.0, Culture=neutral, PublicKeyToken=null" or
a dependency on it was not found. The system cannot find the specified
file.
我检查了我的 DLL。好的,link 是我的应用程序。还有"Bin/Debug/"目录下的文件。
如何帮助我?
PS:我创建了一个带有报告的新应用程序,只有 "pagenumber" 并且它有效。
PS:这是我的代码的一部分:
Public Function ShowReport(ByRef pViewer As ReportViewer, pObj As Object) As Boolean
pViewer.ProcessingMode = ProcessingMode.Local
Dim locReport As LocalReport = pViewer.LocalReport
Dim parameterListe As New List(Of ReportParameter)
Select Case pObj.GetType
Case GetType(S88Model.Items.CEmType)
Dim emType As S88Model.Items.CEmType = pObj
locReport.ReportEmbeddedResource = "TechEditor.ReportEmType.rdlc"
Dim bs As New Windows.Forms.BindingSource()
bs.DataSource = emType
Dim reportdatasource As New ReportDataSource()
reportdatasource.Name = "EmTypeDataSet"
reportdatasource.Value = bs
Dim bs2 As New Windows.Forms.BindingSource()
bs2.DataSource = CProjectData.DefaultData
Dim reportdatasource2 As New ReportDataSource()
reportdatasource2.Name = "ProjectDataSet"
reportdatasource2.Value = bs2
locReport.DataSources.Add(reportdatasource)
locReport.DataSources.Add(reportdatasource2)
pViewer.RefreshReport()
...
我试图创建另一个报告。新报告正在运行(外部 DLL + Standard-Variablen)。
之后我检查了我的第一份报告,在编译时出现错误。我查看了报告的 XML。在 xml 文件的末尾有一些行,如 "codemodel",我的 DLL 被链接到那里。 在我删除 XML 中的完整 "CodeModel"-Tag 后,我没有收到任何错误。 并且它有效。现在我在xml-文件的"DataSetInfo"-标签中只有DLL-Link-信息。
我不知道为什么,但它现在运行了。感谢@Craig 的支持。
我将在我的 VB.net-应用程序 (VS2015) 中创建报告 (Link)。为此,我将一些自己的 objects/classes 作为数据源绑定到本地报告。我还将这些 classes 作为数据源插入到 RDLC 报告中。然后我在报告中使用这些 classes 的数据,例如在 table 或文本框中。当我启动我的应用程序并创建报告时。一切正常。来自我的 class 实例的数据被放置在报告中。伟大的! (PS:用到的class在单独的DLL里面,是我自己写的。)
那我就把我的报告写得漂亮一点。我添加了一个页眉,并在其中放置了一个带有当前页码的文本框。 (从报表数据视图拖放) 之后我想重新启动我的应用程序,但出现错误。我删除了文本框 >> 没有错误。我再次插入带有 "overpagenumber" 的文本框 >> 错误!
但是报错说:他找不到我的DLL(=S88Model)。 (错误消息已翻译)
Error loading the code module: 'S88Model, version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: The file or assembly "S88Model, Version=1.0.0.0.0, Culture=neutral, PublicKeyToken=null" or a dependency on it was not found. The system cannot find the specified file.
我检查了我的 DLL。好的,link 是我的应用程序。还有"Bin/Debug/"目录下的文件。
如何帮助我?
PS:我创建了一个带有报告的新应用程序,只有 "pagenumber" 并且它有效。
PS:这是我的代码的一部分:
Public Function ShowReport(ByRef pViewer As ReportViewer, pObj As Object) As Boolean
pViewer.ProcessingMode = ProcessingMode.Local
Dim locReport As LocalReport = pViewer.LocalReport
Dim parameterListe As New List(Of ReportParameter)
Select Case pObj.GetType
Case GetType(S88Model.Items.CEmType)
Dim emType As S88Model.Items.CEmType = pObj
locReport.ReportEmbeddedResource = "TechEditor.ReportEmType.rdlc"
Dim bs As New Windows.Forms.BindingSource()
bs.DataSource = emType
Dim reportdatasource As New ReportDataSource()
reportdatasource.Name = "EmTypeDataSet"
reportdatasource.Value = bs
Dim bs2 As New Windows.Forms.BindingSource()
bs2.DataSource = CProjectData.DefaultData
Dim reportdatasource2 As New ReportDataSource()
reportdatasource2.Name = "ProjectDataSet"
reportdatasource2.Value = bs2
locReport.DataSources.Add(reportdatasource)
locReport.DataSources.Add(reportdatasource2)
pViewer.RefreshReport()
...
我试图创建另一个报告。新报告正在运行(外部 DLL + Standard-Variablen)。
之后我检查了我的第一份报告,在编译时出现错误。我查看了报告的 XML。在 xml 文件的末尾有一些行,如 "codemodel",我的 DLL 被链接到那里。 在我删除 XML 中的完整 "CodeModel"-Tag 后,我没有收到任何错误。 并且它有效。现在我在xml-文件的"DataSetInfo"-标签中只有DLL-Link-信息。
我不知道为什么,但它现在运行了。感谢@Craig 的支持。