Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting dataset at run time
Message
General information
Forum:
ASP.NET
Category:
Reporting
Miscellaneous
Thread ID:
00930056
Message ID:
00930097
Views:
12
Hi, Fred,

I am trying to do a basic report with 2 tables from sql server.
Jobs & Customer. How can I setup the report using crystal and then at run time set the dataset for my dynamic query. My dataset joins these 2 tables and creates 1 datatable in the dataset. This is the most basic of reports and I cannot get it going.

I have created a XML datdaset to setup the report at design time. But they use distinct table names. At runtime I join the 2 tables and have only 1 name.


In a nutshell, you want to do the following:

1) Create the design-time report in Crystal. You'll need to define your data elements and database tables, using the Database Expert. (You need to do this so that you can drop data elements onto your report using the Field Explorer.

a) If you're using SQL Server, and if you have SQL tables that represent the format of the 'final dataset' that you want to pass to Crystal, you can select the tables from SQL.

b) If you've generated an XML Schema from a Dataset using VS.NET, you can point to the XML Dataset as the table 'format' for the report

2) At runtime, create your dataset that represents the actual data you wish to pass to Crystal. When you pass it to Crystal, you need to do something like the following with the report object that you've instantiated...
oReport.Database.Tables[0].SetDataSource(DsReportData.Tables[0]);
oReport.Database.Tables[1].SetDataSource(DsReportData.Tables[1]); 
...and repeat this for however many datatables are in your dataset. It's important that the # of tables you pass is the same # you defined at design-time, that you set them in the same order that they were set at design time, and that the column names and format/structure is the same. So really, the only difference between what you defined at design-time and what you pass at run-time (aside from the physical location of the data) is the contents.

Let me know if that helps, or if you need anything else.

Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform