PC Review


Reply
Thread Tools Rate Thread

Create CrystalReport from DataSet

 
 
=?Utf-8?B?cmVkbmVvbg==?=
Guest
Posts: n/a
 
      11th Jan 2005
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

 
Reply With Quote
 
 
 
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      11th Jan 2005
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,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"redneon" <(E-Mail Removed)> wrote in message
news:117C8AC8-D1BC-4104-91A5-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?cmVkbmVvbg==?=
Guest
Posts: n/a
 
      12th Jan 2005
> 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

"Ignacio Machin ( .NET/ C# MVP )" wrote:

> 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,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
>
>
> "redneon" <(E-Mail Removed)> wrote in message
> news:117C8AC8-D1BC-4104-91A5-(E-Mail Removed)...
> > 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
> >

>
>
>

 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      12th Jan 2005
Hi,

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

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"redneon" <(E-Mail Removed)> wrote in message
news:E932C843-9FEB-475E-A311-(E-Mail Removed)...
>> 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
>
> "Ignacio Machin ( .NET/ C# MVP )" wrote:
>
>> 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,
>>
>> --
>> Ignacio Machin,
>> ignacio.machin AT dot.state.fl.us
>> Florida Department Of Transportation
>>
>>
>>
>> "redneon" <(E-Mail Removed)> wrote in message
>> news:117C8AC8-D1BC-4104-91A5-(E-Mail Removed)...
>> > 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
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to create a typed dataset from the generic DataSet? =?Utf-8?B?UGV0ZXI=?= Microsoft VB .NET 1 17th Aug 2007 05:16 AM
How to create a type dataset and a untype dataset? =?Utf-8?B?UGV0ZXI=?= Microsoft VB .NET 0 17th Aug 2007 01:49 AM
How to create a PDF file from CrystalReport in .NET 2.0 pareptrc Microsoft VB .NET 1 15th Jun 2006 05:10 PM
C# DataSet and CrystalReport in Windows Form Jason Huang Microsoft C# .NET 2 31st Oct 2005 06:07 AM
connect crystalReport to dataSet how?? =?Utf-8?B?cy1nYWxpdA==?= Microsoft Dot NET 1 2nd Oct 2004 05:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 AM.