在运行时更改对象数据源

时间:2012-12-13 18:59:22

标签: asp.net reporting-services

我正在尝试在运行时切换对象数据源(objectdatasource1和objectdatasource2),并在单击button1时刷新我的reportviewer。我无法弄清楚如何做到这一点,我无法让下面的代码工作。有任何想法吗?谢谢

Dim dataSetName As String = "MyApplication_ModelObject"
        Dim ds As New MyApplication_ModelObjectTableAdapters.DataTableTableAdapter()
        Dim rds As New ReportDataSource("MyApplication_ModelObject", ds.GetData())
        ReportViewer1.LocalReport.DataSources.Clear()
        ReportViewer1.LocalReport.DataSources.Add(rds)
        ReportViewer1.LocalReport.Refresh()

0 个答案:

没有答案