I have a dataset created programatically and I want to use this dataset to bind it to Microsoft ReportViewer.
I tried the Microsoft ReportViewer with DataSet created at design time and it works well.
I have searched a lot and this is the best thing I can find but I see it not logical to create object that simulate the fields in the table. http://aspalliance.com/762
does any one have any thought of how to do it that in case it could be done.
Here is my trial code which is no working
Dim sqlcn As New SqlConnection("server=myserver;uid=myuser;pwd=mypassword;database=mydatabase;") Dim sadapt As New SqlDataAdapter("select * from mytable", sqlcn) Dim ds As DataSet = New DataSet sadapt.Fill(ds, "ds_mytable") Me.DataGridView1.DataSource = ds.Tables(0) BindingSource1.DataSource = ds BindingSource1.DataMember = "ds_mytable" Dim rptSource1 As New Microsoft.Reporting.WinForms.ReportDataSource rptSource1.Name = "test" rptSource1.Value = Me.BindingSource1 Me.ReportViewer1.LocalReport.DataSources.Add(rptSource1) Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "testing.Report1.rdlc" Me.ReportViewer1.RefreshReport()