Attach a dataset to a table (MS reporting)

daviddoria

Member
Joined
Dec 24, 2008
Messages
9
I want to do something like this:


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. ???

However I get this error:
Code:
The table
 
The only thing I could think of was to actually save the table to a database and setup the Table controls query to get the data from that data base. That seems really goofy though if the data is never to be used again, no?

Dave
 
Back
Top