| Author |
Message |
pgeorge33
Newbie
Joined: 04 Dec 2012
Online Status: Offline
Posts: 8
|

Topic: Multiple Records Printing Posted: 04 Dec 2012 at 8:11am |
|
I have an application that contains nearly 100 reports written in C#.net using VS 2008 and I have been able to create most of them, often through repeated trial and error, but I am having a problem with a few reports where data either gets printed multiple times or data that is not contained in my database gets printed.
I generate the data I want to print from a SELECT statement which uses several fields on a Windows form to build the select dynamically. I then connect to my DB, pull the data I need to display, and pass the data set along with some parameters to the report. When I look at the data set before I create the report, it contains the proper information I want to put into the report, so I know my SELECT is working as I expect.
When the report viewer opens however, I get a lot of data in the report that I didn't pass into it with the data set! Often times it is the "correct" data repeated multiple times, but other times it is data that was not even contained in the data set. For example I have a situation today where I am passing 6 rows of data to the report, but the report is 224 pages long! I suspect the problem is in the way I have setup the report using the Database Expert and Links, but for the life of me I can't find anything that helps me find what I am doing wrong.
I have tried changing all of my links through trial and error, and "most" of the time I was able to stumble on the result I wanted. I have one report I am working with today that I have been fiddling with for 2 days and I can't seem to make it display the correct data.
Can anyone point me to a tutorial or article that might shed some light on what is happening here? I can post more details if someone needs them, but I was hoping someone might have some insight as where I might be able to find something that addresses this type of CR related issue.
It seems like it should be simple. If I pass the report 20 lines of information in a data set, I want it to show 20 lines...
Thanks for any information you can provide.
|
|
Peter
|
IP Logged |
|
|
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|

Posted: 04 Dec 2012 at 8:48am |
|
first make sure you aren't saving data with report, there are like 5 areas in CR that have this option
|
IP Logged |
|
pgeorge33
Newbie
Joined: 04 Dec 2012
Online Status: Offline
Posts: 8
|

Posted: 04 Dec 2012 at 9:40am |
|
I'm not sure I understand where "saving data with the report" would be done. I don't see any reference to in in CR
|
|
Peter
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|

Posted: 04 Dec 2012 at 9:58am |
|
File, Save Date with Report.
|
IP Logged |
|
pgeorge33
Newbie
Joined: 04 Dec 2012
Online Status: Offline
Posts: 8
|

Posted: 05 Dec 2012 at 12:28am |
|
I don't see any reference to saving data with the report, so I have not saved the data with the report. I am using VS 2008 to generate the crystal reports. Each time I try something different, the data that gets displayed changes, but it still turns a data set with perhaps 6 or 10 lines of information into 200 - 6000 pages of report...
|
|
Peter
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|

Posted: 05 Dec 2012 at 6:25am |
|
try adding code to unload the form
unload reportname
worked for me before
and or try this before viewing in CR VIEWER
discardsaveddata = true
CrViewer1.Refresh
CrViewer1.ViewReport
Edited by comatt1 - 05 Dec 2012 at 6:29am
|
IP Logged |
|
pgeorge33
Newbie
Joined: 04 Dec 2012
Online Status: Offline
Posts: 8
|

Posted: 05 Dec 2012 at 9:49am |
|
Thanks,
I'll give it a try
|
|
Peter
|
IP Logged |
|
pgeorge33
Newbie
Joined: 04 Dec 2012
Online Status: Offline
Posts: 8
|

Posted: 05 Dec 2012 at 9:56am |
|
Still no joy. I don't seem to have methods for discardsaveddata or for ViewReport. I must be running a different version?
I started from scratch and tried another approach, but not much luck there either. I'm now printing the right number of records, but not all of the data from the data set gets displayed...
Maybe I'll re-post with the new approach and see if anyone can help.
|
|
Peter
|
IP Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|

Posted: 05 Dec 2012 at 10:00am |
|
my logic wasn't exact, but if you really want help, just throw this to dblank he has more experience with the various ways of utilizing CR than I do.
|
IP Logged |
|
|
|