Print Page | Close Window

Crystal Reports & Dataset

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=8
Printed Date: 03 May 2024 at 6:57am


Topic: Crystal Reports & Dataset
Posted By: farid_nasiri
Subject: Crystal Reports & Dataset
Date Posted: 14 Nov 2006 at 11:05pm
I have the following code:

CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
rpt.Load(@"C:\MyReport.rpt");
rpt.SetDataSource(myDataSet);
rpt.PrintToPrinter(1,true,1,1);

the problem is that the report print only the data what the report was set at originaly it ignores what's in myDataSet.

How can I force it to use data from myDataSet?



Replies:
Posted By: hilfy
Date Posted: 20 Nov 2006 at 12:08pm
In the report definition itself, you'll need to turn OFF "Save Data with Report".
 
Unfortunately, the default for Crystal is to save data with the report and have to either explicitly turn it off for each report or there is a setting in Crystal that you can change to default it to off.  You'll still have to explicitly change any reports created prior to defaulting to off, though.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: sonalpatel
Date Posted: 03 Jan 2008 at 10:27pm
i have same problem.. but the save data with report is turned off still having that problem ?

thanks in advance..


Posted By: jkwrpc
Date Posted: 10 Jan 2008 at 10:13am
This may not resolve the issue, but have you tried moving the rpt.load statement so it follows the rpt.setDataSource(myDataSet) line.
 
rpt.SetDataSource(mydataSet)
rpt.Load
 
My thought is you may need to populate the new dataset and point the report to it before it loads.
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: hilfy
Date Posted: 10 Jan 2008 at 3:42pm
I don't think that will work, John.  rpt.Load loads the report from a file.  So, you don't have any datasources to set until after the file is loaded.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: jkwrpc
Date Posted: 11 Jan 2008 at 6:55am
Well it was a shot in the dark...I was thinking that when the report loaded it may need to pull the data from the dataset and then load that data for presentation. However, what you say makes sense as to why it would not work.
 
 
Thanks,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net



Print Page | Close Window