By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,588 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,588 IT Pros & Developers. It's quick & easy.

C# program with repeating records printed in Crystal report

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.