The Beginner
Member
- Joined
- Nov 25, 2009
- Messages
- 6
- Programming Experience
- 1-3
Hi,
I am trying to use Microsoft Reports in my Application. I have done this successfully using Report Wizard, but I want to do it dynamically now. I have created Dataset and BindingSource uptill now but I am unable to populate controls like textboxes on the Report4.rdlc with the data from the dataset. Can someone plz help me with this. So far I am here... and there is no error but I don't know how to display the data...
I am trying to use Microsoft Reports in my Application. I have done this successfully using Report Wizard, but I want to do it dynamically now. I have created Dataset and BindingSource uptill now but I am unable to populate controls like textboxes on the Report4.rdlc with the data from the dataset. Can someone plz help me with this. So far I am here... and there is no error but I don't know how to display the data...
VB.NET:
Dim cn As New SqlConnection("myconnectionstring")
cn.Open()
Dim ds As New DataSet
Dim bs As New BindingSource
Dim cmd As New SqlCommand("Select * from ItemCount", cn)
Dim da As New SqlDataAdapter
Dim ReportSource1 As New Microsoft.Reporting.WinForms.ReportDataSource
da.SelectCommand = cmd
da.Fill(ds, "ItemCount")
bs.DataSource = ds
bs.DataMember = "ItemCount"
ReportSource1.Name = "ds_ItemCount"
ReportSource1.Value = bs
ReportViewer1.LocalReport.DataSources.Add(ReportSource1)
ReportViewer1.LocalReport.ReportEmbeddedResource = "ReportsApplication2.Report4.rdlc"
Me.ReportViewer1.RefreshReport()