473,508 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# program with repeating records printed in Crystal report

I have a C# program that user would select several search criteria and then
outputs to the Crystal Report. A message is output to user if no matching
record is found. In my code I also clear, removed and dispose of the table
in the dataset that was used which should have nothing in it any way. I then
clean up the search string that I built at run time.

Now in the same screen, user change one of the search criteria and now there
are matching records. However, each records are repeated n time for each
prior search that has no matching records.

I have examined the row counts in the dataset while in the debug mode(int y
= dsLocal.Tables["trips"].Rows.Count;) and it shows 5 trips but once it goes
to crystal it would double or triple of that.

This repeating problem only occurs after the no match record message is
printed. If user was able to find matching record each time then no repeated
records will show in the report.

I'm not sure and don't know if this is a C# or Crystal problem. Would be
great I I can first just determin that. Very strange bug and appreciate any
help,
Alpha
Nov 17 '05 #1
2 3093
My first guess is that there is some other table in the data set you
are passing to Crystal, and that table has foreign keys back into the
table that you're working with... something like that.

The only way I know of to have Crystal produce multiple copies of data
is to make mistakes in grouping / table joins. In other words, have
multiple tables and report at the wrong level in the hierarchy,
together with messed up table linkages.

Does the DataSet you set as your Crystal data source have any tables in
it other than the one you want to report on?

As well, you might want to call AcceptChanges() on the data set before
passing it to Crystal, just in case that is affecting things (but it
doesn't sound like that's the problem).

Nov 17 '05 #2
The problem is in the dataset. I've tried working on different things all
day again today and found there is one way to get rid of this repeating rows
printing. It repeats as many times as the user gets a message saying 'no
matching records found'. I put the following in after the message:

dsLocal.Tables.Clear();
dsLocal.Dispose();

The problem goes away. There are 2 tables that I put in this dataset,
Trips, Balances and Global. Global contains only stuff for header in
Crystal. Trips and balances are the ones with data.

I finally found the bug just now!!!! It's not my query it's not my crystal
report...... It's after the no matching record I clear and removed the Trips
and Balances tables but forgot to do so for the 'Global' table!!!!!! So so
so very frustrating! I spent 2 solid days on this stupid bug! I can't find
this bug doing debuggin in VS at all.

Thank you for your help and it was helpful,
Alpha

"Bruce Wood" wrote:
My first guess is that there is some other table in the data set you
are passing to Crystal, and that table has foreign keys back into the
table that you're working with... something like that.

The only way I know of to have Crystal produce multiple copies of data
is to make mistakes in grouping / table joins. In other words, have
multiple tables and report at the wrong level in the hierarchy,
together with messed up table linkages.

Does the DataSet you set as your Crystal data source have any tables in
it other than the one you want to report on?

As well, you might want to call AcceptChanges() on the data set before
passing it to Crystal, just in case that is affecting things (but it
doesn't sound like that's the problem).

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2159
by: Tony Kennedy | last post by:
Hi, We have a SQL server db backend for our ERP system. I have written a Crystal Report to extract data from one particular table called itemspecbomw (c.30000 records) which contains amongst...
6
13099
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
3
6364
by: Chuck | last post by:
Hi, I have a somewhat unique problem (at least unique to me, and I've been doing this for longer than I care to admit). I have a client that needs to print cards onto perforated card stock (so...
0
1501
by: marcellus7 | last post by:
Hows it going everyone. Im pretty new to Crystal Reports, and am in the process of trying to setup my first Crystal Report in my windows app. I am loading data from a DataSet, and am finally getting...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.