Hi,
I am creating reports using a dataset which is being created at runtime.I have a
vb.net form to which crystalreportviewer control and a button are added. When I click on the button the reportviewer should show the report.
The code for button as follows
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cr As New CrystalReport1
Dim ds As New Data.DataSet("MyTable")
Dim rds As Data.DataSet
Dim dt As New Data.DataTable("MyTable")
dt.Columns.Add("Age1", System.Type.GetType("System.Int32"))
dt.Columns.Add("Age2", System.Type.GetType("System.Int32"))
dt.Columns.Add("Age3", System.Type.GetType("System.Int32"))
Dim dr As Data.DataRow
dr = dt.NewRow
dr(0) = 1
dr(1) = 2
dr(2) = 3
dt.Rows.Add(dr)
dr = dt.NewRow
dr(0) = 1
dr(1) = 2
dr(2) = 3
dt.Rows.Add(dr)
dr = dt.NewRow
dr(0) = 1
dr(1) = 2
dr(2) = 3
dt.Rows.Add(dr)
dr = dt.NewRow
dr(0) = 1
dr(1) = 2
dr(2) = 3
dt.Rows.Add(dr)
ds.Tables.Add(dt)
cr.SetDataSource(ds)
cr.SetParameterValue(0, 1)
CrystalReportViewer1.ReportSource = cr
End Sub
But when I try to run, it says no tables in the dataset. I am quite pissed with this problem. :( Any one can help me out. Is there any alternatives for this method.
Thanks
Dhiman