?
Solved

Crystal Reports repeats rows in detail section

Posted on 2005-03-15
13
Medium Priority
?
619 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
13 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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