I want to do something like this:
However I get this error:Code:'create a dataset and a table Dim ds As New DataSet ds.Tables.Add("TestTable") ds.Tables("TestTable").Columns.Add("Names", System.Type.GetType("System.String")) 'create a test row Dim TestRow As DataRow = ds.Tables("TestTable").NewRow TestRow.Item("Names") = "hello world" ds.Tables("TestTable").Rows.Add(TestRow) 'attach dataset to report Dim dsname As String = "Dataset1" Dim rs As New Microsoft.Reporting.WinForms.ReportDataSource(dsname, ds.Tables("TestTable")) ReportViewer1.LocalReport.DataSources.Add(rs) 'attach dataset to table on report ReportViewer1.LocalReport. '???
There is no way for me to attach the dataset at design time, because it is not yet created! Is there a way around this? Also notice the last line is not complete in the code - how do you actually assign the dataset to the table on the report?Code:The table ‘table1’ is in the report body but the report has no data set. Data regions are not allowed in reports without datasets.
Thanks!
Dave




Reply With Quote