I have two sql queries to display two slightly different sets of data.
I can display both in two DataGridViews.
I am trying to show both in two tablix on one rdlc report.
The two queries are in ReportQuery & ReportQuery2
' create a data adaptor
Dim da As SqlDataAdapter = New SqlDataAdapter(ReportQuery, SQLConnection)
' create a new data set
Dim ds As DataSet = New DataSet
' fill the data adapter
da.Fill(ds)
' clear the datasource
ReportViewer1.LocalReport.DataSources.Clear()
' set the dataource (DataSet1 is defined in the matrix in the rdlc file)
Dim rds1 As New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0))
' add a new datasource
ReportViewer1.LocalReport.DataSources.Add(rds1)
' second table on one report
Dim da2 As SqlDataAdapter = New SqlDataAdapter(ReportQuery2, SQLConnection)
Dim ds2 As DataSet = New DataSet
da2.Fill(ds2)
Dim rds2 As New Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Add(rds2)
ReportViewer1.RefreshReport()
In the tablix I have DataSet1 for the first and DataSet2 for the second.
I find I am getting the first set data repeated rather than the second set of data.
Do you know what I am doing wrong?
I can display both in two DataGridViews.
I am trying to show both in two tablix on one rdlc report.
The two queries are in ReportQuery & ReportQuery2
' create a data adaptor
Dim da As SqlDataAdapter = New SqlDataAdapter(ReportQuery, SQLConnection)
' create a new data set
Dim ds As DataSet = New DataSet
' fill the data adapter
da.Fill(ds)
' clear the datasource
ReportViewer1.LocalReport.DataSources.Clear()
' set the dataource (DataSet1 is defined in the matrix in the rdlc file)
Dim rds1 As New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0))
' add a new datasource
ReportViewer1.LocalReport.DataSources.Add(rds1)
' second table on one report
Dim da2 As SqlDataAdapter = New SqlDataAdapter(ReportQuery2, SQLConnection)
Dim ds2 As DataSet = New DataSet
da2.Fill(ds2)
Dim rds2 As New Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Add(rds2)
ReportViewer1.RefreshReport()
In the tablix I have DataSet1 for the first and DataSet2 for the second.
I find I am getting the first set data repeated rather than the second set of data.
Do you know what I am doing wrong?