?
Solved

Crystal Reports repeats rows in detail section

Posted on 2005-03-15
13
Medium Priority
?
629 Views
Last Modified: 2010-05-18
Hi All,
I really could use ur help here, i have 3 tables in Ms Access, and a vb.net application, in d app i have a form wt a crystalreportviewer, also i have a crytal report.rpt with a dataset.xsd.
The problem here is i supply 2 parameters at runtime and the result shoud come from two tables, the result appears alright on the crystal report, but the thing is in the detail section, lets say the result is one row, i get three rows appearing in the cryst,report, if the returned data is 2 rows, i get six rows in the cryst.report and so on.
here is the code i am running
 Try

                rpt = Nothing
                rpt = New SalesReceiptCrystalReport
                sql = "Select tblsales.*,tblproduct.productname from tblProduct inner join tblsales on tblProduct.ProductId=tblsales.productid  where salesdate=Format('" + UiCalendarCombo1.Text + "','mm/dd/yyyy')AND ReceiptNumber=" + UiTextBox1.Text + ""
                Dim sql1 = "select * from tblProduct"
                Dim sql2 = "select * from tblCompany"
                adt = New OleDb.OleDbDataAdapter(sql, GetConnStr)
                Dim adt1 As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql1, GetConnStr)
                Dim adt2 As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql2, GetConnStr)




                objds = New DataSet
                adt.Fill(objds, "tblSales")
                adt1.Fill(objds, "tblProduct")
                adt2.Fill(objds, "tblCompany")

             
                rpt.SetDataSource(objds)
                CrystalReportViewer1.ReportSource = rpt
                rpt.PrintOptions.PrinterName = "" '"HP LaserJet 1200 Series PCL 6"
                rpt.PrintToPrinter(1, False, 1, 1)
0
Comment
Question by:yahuxer
  • 7
  • 3
11 Comments
 
LVL 5

Expert Comment

by:fahimnxb
ID: 13542904
Do one thing debug your application after
                objds = New DataSet
                adt.Fill(objds, "tblSales")
                adt1.Fill(objds, "tblProduct")
                adt2.Fill(objds, "tblCompany")
Insert a break point at:
 rpt.SetDataSource(objds)

and go in command window and type
?objds.Tables(0).Rows.Count
?objds.Tables(1).Rows.Count
?objds.Tables(2).Rows.Count

and tell the result.. is this count equals the rows in DB or it is different.

Yes this is not exactly the solution but I need to know either ur report is repeating rows due to some wrong grouping or code/query is creating problem.

Regards,
Me
0
 

Author Comment

by:yahuxer
ID: 13543062
on the command window
>?objds.Tables(0).rows.count
1
>?objds.Tables(1).rows.count
1
>?objds.Tables(2).rows.count
7

tthe fields i need from the tables are
tblsales--recpnum,name,qty,price,discount,amt
tblcompany-name,phone,add
tblProduct-name

i forgot to mention that on my development sys, crystal report genrates the correct report, however on SOME sys it repeats the rows. i have run the app on two sys wt xp pro and one was ok, while the other one repeats the rows..
0
 

Author Comment

by:yahuxer
ID: 13543117
the table  fields i wrote above  are fields in the relevant  table, so ideally i am looking for a row from the table that matches the search criteria.
so lets say i specify tblsales.recpnum, i want all the fields in tblsales, and a field from tblProduct( there is a relationship btw the two tables) and then some fields from tblCompany which goes into the report header.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:yahuxer
ID: 13544120
hi, i have edited the sql to get data from just two tables,tblcompany and tblsales,
i have checked on the command window it is return the correct number of rows, however crystal report still repeats the rows in the detail section
0
 
LVL 5

Expert Comment

by:fahimnxb
ID: 13544533
" forgot to mention that on my development sys, crystal report genrates the correct report, however on SOME sys it repeats the rows. i have run the app on two sys wt xp pro and one was ok, while the other one repeats the rows.."

If this is the situation, then there are two things. From the row count we are sure that repetition of rows is due to some thing happening in crystal not in db and sql.

1- First thing is the report group by section has some thing wrong in it.
2- But as you say its working ok on some other systme then only one thing left. You have lacking some crystal patch. Check on crystal site for the latest patch and problem lists etc.

let me know if there is any confusion.

Regards,
Me
0
 

Author Comment

by:yahuxer
ID: 13555481
k, lemme try the windows update if n e thing happens i will let u know, tnx
0
 
LVL 5

Expert Comment

by:fahimnxb
ID: 13562473
You are welcome.
0
 

Author Comment

by:yahuxer
ID: 13856669
hi all, i have made a post in the community support requesting that the question be closed,and how i came about the solution as well.tnx everybody for ur help;.
0
 

Author Comment

by:yahuxer
ID: 13856836
better yet lemme state the hw i resolved the problem; remember tblcompany that gets the company name to put in the header section, well there was three rows of the company( i guessed the guy puttin in the records did that, cos on the dev system i entered only once thus the correct report on the dev. system)so i guess for each recordset returned it iterates thro tblcompany to genrate a report base on the number of rows in the tblcompany( sorry).tnx guys for ur inputs, pls c the community support for my request to close the question.
0
 

Author Comment

by:yahuxer
ID: 13865643
i have responded on hw the issue was resolved
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 13902635
The question has been PAQ'd and the 500 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question