I am trying to create a program in which I put Datatable data in Crystal Report. Here is the code:
ReportDocument report_doc = new ReportDocument();
report_doc.Load(Server.MapPath("Trtp.rpt"));
string[] columns = new string[] { "col1", "col2", "col3", "col110", "col111" };
DataTable dt = new DataTable();
int count = columns.Count();
for (int i = 0; i < count; i++)
dt.Columns.Add(columns[i], typeof(string));
myConnection.comm.CommandText = @"select col1,col2,col3.col110,col111 from TabledataT where " + query;
myConnection.reader = myConnection.comm.ExecuteReader();
dt.Load(myConnection.reader);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
report_doc.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource = report_doc;
CrystalReportViewer1.RefreshReport();
On the aspx page:
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
Trtp.rpt I have chosen empty

Error in this line
report_doc.SetDataSource(ds.Tables[0]);
Mistake:
The report has no tables
This is the first time I'm trying to create a program that uses a crystal report, so I donβt know about it.
Why am I getting this error?
thanks
source
share