Create CrystalReport from DataSet

G

Guest

I've populated a DataSet in my C# program and verified that it contains the
data I passed it. I've then created a blank CrystalReport and set it's
DataSource to my DataSet. Then I created a CrystalReportViewer and set it's
ReportSource to my CrystalReport. When I run the program though nothing get's
shown in my viewer. The following is how I did it...

OdbcConnection dbConn = new OdbcConnection();
OdbcCommand dbCommand = new OdbcCommand();
OdbcDataAdapter dbAdap = new OdbcDataAdapter();
DataSet dbData = new DataSet();
CrystalReport1 report = new CrystalReport1();

dbConn.ConnectionString = @"DSN=Crystal;";
dbConn.Open();
dbCommand.CommandText = "SELECT * FROM Student ORDER BY studentid";
dbCommand.Connection = dbConn;
dbAdap.SelectCommand = dbCommand;
dbAdap.Fill(dbData, "Students");
report.SetDataSource(dbData);
reportViewer.ReportSource = report;

I don't want to use the wizard that comes with VS .NET because I want to
completely understand Crystal Reports and be able to manipulate the report
just by editing the DataSet by using SQL commands.

Any ideas?

Darrell
 
I

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

Hi,

First you have to design your report, how you want it to looks like, the
grouping, etc

after that you can set the datasource of it to your dataset. At design time
you only need the structure of the dataset.

cheers,
 
G

Guest

At design time you only need the structure of the dataset.

Is there no way to make a CrystalReport completely dynamic? I don't know the
structure of the DataSet at design time becaue I don't populate it with data
until run time. And depending on what SELECT statement I run at run time
changes the structure of the DataSet.

Darrell
 
I

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

Hi,

No it's not, at least with the version shipped with Vs.NET

Cheers,
 

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