I am trying to make a program where I put the data of a Datatable in a 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("Data");
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(dt);
CrystalReportViewer1.ReportSource = report_doc;
CrystalReportViewer1.RefreshReport();
In the aspx page :
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" />
Error :
Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object
Now i took one Trtp.rpt file, and from DataBaseExpert i have taken DataSet and place the fields in report
then I taken one .aspx file where i place ReportViewer.
Why I am getting this error ?
Thanks