Avatar of Umut Şeker
Umut Şeker
Flag for Türkiye

asked on 

Connect Crystal Report to a DataSource

I'm binding a Crystal Report Source to a SQLDataSource(SqlDataSource1) by a button click like;

    DataView dvEnc = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
    CrystalReportSource1ReportDocument.SetDataSource(dvEnc.Table);

From that poing no problem. The CrystalReportViewer show the report.

But before this operation The Crystal Report runs it's SQL queries and shows wrong data and this slows the pageload. I don't want this happen so I tried to set the datasource(empty one) of CrystalReportSource on Page Init  like;
......Page_Init(..)
{
CrystalReportSource1.ReportDocument.SetDataSource(new DataTable("EmptyDataTable"));
}
so it's ok no data will be displayed but after I clicked the button, the code in button click work but the CrystalReportViewer don't show any data.
If necessary, I'm using Visual Studio.Net 2005, Asp.Net with C# and the Crystal Report that comes with
VS 2005.
Thanks,
.NET ProgrammingCrystal ReportsASP.NET

Avatar of undefined
Last Comment
Mike McCracken

8/22/2022 - Mon