DataSet to Crystal report?

K

krunom

Hi,

i am a newby in Crystal Reports design, and i wrote a c# windows form
application that creates a DataSet.

And, now i want to pass this DataSet to CrystalReport (via DataSource?) and
i do not know how to display this DataSet in my Crystal Report :(


Please, help.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

CR create a new class per report, you can instantiate this class and assing
the dataset you created to it, note that the schema should be the same .
Here is a piece of code that does just that:

DataSet ds = dbm.GetPPCDelaysBetweenDates(fromDate, toDate); //populate the
DS

CrystalDecisions.CrystalReports.Engine.ReportDocument theReportDoc = new
PPCSyncDelay_Report(); // PPCSyncDelay is the name of my report

theReportDoc.SetDataSource(ds); //set the datasource of the report

//Set the viewer
CrystalReportViewer1.ReportSource = theReportDoc;
CrystalReportViewer1.DataBind();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top