Data Connectivity
 Crystal Reports Forum : Crystal Reports .NET 2003 : Data Connectivity
Message Icon Topic: Crystal Reports & Dataset Post Reply Post New Topic
Author Message
farid_nasiri
Newbie
Newbie


Joined: 14 Nov 2006
Online Status: Offline
Posts: 5
Quote farid_nasiri Replybullet Topic: Crystal Reports & Dataset
    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?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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
IP IP Logged
sonalpatel
Newbie
Newbie


Joined: 03 Jan 2008
Location: India
Online Status: Offline
Posts: 1
Quote sonalpatel Replybullet 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..


Edited by sonalpatel - 03 Jan 2008 at 10:28pm
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet 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.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet 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
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet 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.
www.CustomReportWriters.net
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.033 seconds.