How do I populate Crystal Reports, using a DataTable?

P

Pierre

Hi,

Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#?

Regards,
Pierre
 
B

Brent Thompson

Hi,

Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#?

Regards,
Pierre

Pierre,

This is how you do it using OLEDB, and a table view in MSSQL. This assumes
you have setup your report viewer with the wizard.

-------------------------

dataSet21.Clear();
oleDbDataAdapter1.Fill(dataSet21,"your_table_view");

CrystalReport2 custReport = new CrystalReport2();
custReport.SetDataSource(dataSet21);

TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo = custReport.Database.Tables["your_table_view"].LogOnInfo;
ConnectionInfo connectionInfo = new ConnectionInfo ();
connectionInfo = logOnInfo.ConnectionInfo;
// Set the Connection parameters.
connectionInfo.DatabaseName = yourcatalog;
connectionInfo.ServerName = workstationID;
MessageBox.Show(connectionInfo.ServerName);
//connectionInfo.Password = "yourpassword";
//connectionInfo.UserID = "youruserid";
custReport.Database.Tables ["Vw_Address_Label"].ApplyLogOnInfo(logOnInfo);
crystalReportViewer1.ReportSource = custReport;
crystalReportViewer1.Refresh();
crystalReportViewer1.RefreshReport();
-----------------------
 
P

Pierre Basson

Hi Brent,

Thanks, but I am still have major difficulty getting Crystal Reports to
work properly.

I have three tiers i.e. ASP.Net, Business Logic Layer and the Data
Access Layer. I get the data back from an stored proc on a SQL 2000
database and then manipulate the DataTable in the Business Logic layer,
filtering out certain records, in order to obtain the data which needs
to be displayed on the report.

The problem I am having, is populating the unbound "fields" on the
actual report with data. The report is being displayed, but I cannot
find documentation on populating the actual fields.

Does anyone PLEASE know of a way in which I can do this?

Thanks,
Pierre
 

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