我有一个现有的类结构,希望/需要将它用作使用vb和2005的一系列报告的数据源(尽管我们几乎已准备好移至2010 ,所以,如果今天将解决这一招病!)报告查看器 - 带有嵌套列表对象的对象
使用gotreportviewer sample嵌套对象香港专业教育学院增加了一个reportmanager类暴露其香港专业教育学院填充了我的所有数据和返回(的对象)列表的GetData方法。数据在数据绑定点存在且正确,我可以添加和引用顶级属性,但无论我尝试什么语法,都无法引用嵌套类/列表中的字段。我得到各种各样的消息,从输出字段中的“#Error”到任何内容,都不会编译。
我的阶级结构大致是这样的缩略形式:
Assembly0
Class ReportManager
TheData as List(Of Object)
New() 'that populates TheData from the class structure below
GetData() as List(of Object)
Assembly1
Class Test
aProperty1 as String
aProperty2 as Int
aProperty3 as String
aProperty4 as String
aProperty4 as List(of aType1)
Assembly2
Class AaType1
aProperty1 as String
aProperty2 as Int
aProperty3 as String
aProperty4 as String
aProperty4 as List(of aType2)
aProperty4 as List(of aType3)
aProperty4 as String
Assembly3
Class aType2
aProperty1 as Boolean
aProperty1 as String
you get the idea
and so on.....
我主要的应用程序
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create an instance of our ReportManager Class
Try
' trust assemblies used in get data
ReportViewer1.LocalReport.ExecuteReportInCurrentAppDomain(Assembly.GetExecutingAssembly().Evidence)
ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("assy1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234")
ReportViewer1.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("assy2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1234")
' etc through ALL dependant assemblies
' create datamanager, that will populate its TheData property
Dim reportMan As Data.Reporting.Manager = New Data.Reporting.Manager(18) ' test id sent
' this is the method from the gotreportviewer sample, which only allows you to reference top level properties, regardless of syntax used. i.e. =Fields!Prop.Value.SubProp
' doesnt work
'ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DummyDataSource", reportMan.GetData))
'Me.ReportingDataBindingSource.DataSource = reportMan.GetData
' this is the only method i have found that allows me to reference an objects nested property and its fields.....?
Data = reportMan.GetData()
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("Data_Reporting_ReportingData", Data))
' fortnatley there is only ever one test in the list, HOWEVER there will be 4 specimens and n stages below that and so on..
Dim SpecimenData As SpecimenList = Data(0).Specimens
Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("Tests_Specimen", SpecimenData))
' so this method is no good either. currently only a test its just returning the first specimen.
'Dim StageData As Tests.Stages = Data(0).Specimens(0).Stages
'Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("Tests_Specimen", SpecimenData))
' render report
Me.ReportViewer1.RefreshReport()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
末次
修复我在网上找到/谷歌搜索:
你必须添加“ExecuteReportInCurrentAppDomain”, 做了没有区别。
您必须添加 Assembly:AllowPartiallyTrustedCallers()到AssemblyInfo.vb,没有区别。
必须强烈名字,你依赖程序,做到这一点和它没有摆脱 关于呼叫的错误报告 (本地化)的“代码”属性正在取得进展。
已尝试使用= Fields!Property.Value.SubProperty语法并且它不工作!不管我尝试什么样的变化。
“在RDLC - 此语法同样适用于顶级性能
= SUM(!字段TestVersion.Value,‘Data_Reporting_ReportingData’)”使用在上面的代码替代方法列表这个作品
=第一(场!Index.Value, “Tests_Specimen”)',但这些不为其子属性
=第一(场!Specimens.Value.Index, “Data_Reporting_ReportingData”)
=领域!Specimens.Value 。索引
=领域!Specimens.Value.Index.Value这是否意味着IM布莱恩得到别无选择,只有创造这样 昏暗SpecimenData作为Tests.SpecimenList =数据(0).Specimens为每一个嵌套的对象吗?也是由于显而易见的原因,而不是必须将整个数据结构变得庞大。
我已经试过所有我能找到关于这一点,实在太少了,一切都点回到同一三四文章/博客文章,仅仅的arent为我工作,thier样品未修改的工作,但他们都不当应用于嵌套列表或嵌套的继承列表类型的对象时工作。
有没有人有任何使用嵌套列表实际工作的对象的示例代码?因为我可以找到除了最简单的情景之外的其他工具。即一个程序集或一个代码文件,或者不包含嵌套列表或简单/本地类型。
我一直在这一周的最佳部分!即时通讯现在秃头和强调请帮助。
失败,任何人都可以建议一个支持这种事情的第三方供应商? 没有水晶?卵石?
appologies文本的墙...... MATMA
呀,这似乎是一种解决,但我不看中经历的篮球执行解决方案从启动对象IM是传统的东西,必须在整个有200个对象它的整个heirachy – Matma 2012-11-13 09:35:02