Print Page | Close Window

Creating Crystal Reports using Datasets

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9
Printed Date: 30 Apr 2024 at 3:19pm


Topic: Creating Crystal Reports using Datasets
Posted By: farid_nasiri
Subject: Creating Crystal Reports using Datasets
Date Posted: 14 Nov 2006 at 11:07pm
I will start from the scratch.

1. First you have to create a XML dataset file which can be done by right
clicking on your project (Solution Explorer) Add - Add New Item then choose
Dataset. Design your dataset which is pretty straight forward.

2. Now design the report using the Dataset you have created above which can
be done by right clicking on your project (Solution Explorer) Add - Add New
Item then choose Crystal Reports this time. You will be prompted for the
data instead of using the normal way (ie tables) choose Project Data then
choose ADO.NET Datasets. Now select the one you have created in Step 1 and
start designing your report based on that dataset.

3. Now coming to your coding...

Instead of using the standard Dataset. Create a new instance of the Dataset
that you have created in Step 1

Dim ds as New MyDataset() 'The dataset that you have created in XML

4. Fill this Dataset with data as you do for anyother Dataset.

5. Create a new instance of the Crystal report.

Dim report as New MyReport()

6. Now do the binding

 reporpt.SetDataSource(ds)
 ReportViewer.ReportSource = report

Basically once you understand the flow it's very straight forward creating
Reports using Datasets.



Replies:
Posted By: raiyan
Date Posted: 11 Jan 2007 at 9:27pm

farid_nasiri,

Thanks for a good post.
 
I did exactly as you said , now whenever I run the program , it asks for server name , database name , password etc. i know what the database name, user id and password is. i am not sure what should be the server, can you help me ? is it the same as the database name ? I have used oracle data adapter for fectching the data from backend.


-------------
:)


Posted By: raiyan
Date Posted: 11 Jan 2007 at 11:56pm
hey, i've solved it myself !
 
The thing is , I have to connect with the database first , then fill dataset , then bind. Initializing the reports from designer does not work in this case.


-------------
:)


Posted By: lovesirius12
Date Posted: 18 Apr 2007 at 1:06am
hi. i did created a dataset and put three tables in it. i set it as the data source for my crystal report form.

but when i run it, there was an error and said that the report does not have tables. i dont understand.

please help! thanks.


Posted By: raiyan
Date Posted: 18 Apr 2007 at 6:48am

Did you use the dataset builder in .net to build you dataset ? The tables(schema) in dataset must match exactly with the tables(schema) in your database. Make sure that first. Then create an instance of that dataset class in you project.

When you program starts, connect to the databse.
 
After connecting, you can use a data adapter to fill the dataset.
 
Dont forget to set the dataset as datasource for the report.
 
You'll find the things mentioned above in many other places, but these are  common sources of error. So make sure you've done these things right.
 
One more thing. If you find it difficult to make the dataset exactly like the schema in your database, you can try untyped dataset.


-------------
:)


Posted By: lovesirius12
Date Posted: 19 Apr 2007 at 6:27pm
hi. thanks raiyan.


Posted By: SriramRamani
Date Posted: 29 Oct 2009 at 5:37am
Hi there,

     Here is my situation. I have created a window based application with Access as the database there are 7 tables in it. I have created a deployment project in which i have included all the files (.exe .mdb). Now when i install the application in the client's m/c this database and the exe files gets copied to somewhere as per thee user's wish during install(installing location).. Let us consider the file has (i mean the dbs file , the mdb file)been copied to c:\application. when i print a report in the application it has to fetch the dbs directly from this location.

i did created a dataset and put a tables in it. i set it as the data source for my crystal report form.
but when i run it, there was an error and said that the report does not have tables. i dont understand.

please help! thanks.
Very urgent please

-------------
Sriram



Print Page | Close Window