Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i am vb.net programer,i am using while loop to add my records to crystal report here is my algorithm:
1.adding each item to dataset object
2.after completion of adding items it into dataset object
3.set dataseource to crystall report
4.and display report
my problem is:-its working fine but but when their are more entries its taking huge time to display ,so how to reduce time of loading it into dataset object and display crystal report.Thanks for helping.
Posted
Comments
Sinisa Hajnal 16-Feb-15 2:18am    
What is the source for the loop? Collection? Is there a way for you to fill the dataset directly from database - such as stored procedure?
lakshjoshi 16-Feb-15 2:29am    
i will make connection to database,i will take records from database,fill it one by one using while loop
like
query = "select *from GLMAST where fbankcode='" & gbankid & "' and fgroup='" & fgroupreader & "'" & _
"and fbranchcode='" & gbranchid & "'"
cmd = New SqlCommand(query, cm)
dr = cmd.ExecuteReader
While (dr.Read)
fglhead = dr!fglhead
fglcode = dr!fglcode
end while

1 solution

Why would you fill them one by one?

SQL
SELECT * FROM GLMAST WHERE "put those conditions that return you the list of need IDs


Set this as your command query and

C#
DataSet ds = new DataSet;
DataAdapter da = New DataAdapter
// set command etc as needed
da.Fill(ds)


Please move the code from comment into the question. Thank you.
 
Share this answer
 
v3
Comments
lakshjoshi 17-Feb-15 5:00am    
i have to display individual item in crystal report so i have to add each item individually how to do it...
Sinisa Hajnal 17-Feb-15 6:21am    
Sorry, I don't understand. What do you mean by "display individual item"...you're adding multiple items into dataset. Therefore you're NOT showing individual items, you're showing list of items...
lakshjoshi 18-Feb-15 0:29am    
yes i am adding list items you'r right..but instead of filling i am using this concept
Dim cr As New ReportDocument
cr = New topdepositor_ind//crystall report name
cr.SetDataSource(obj.Tables("TOP_DATA"))//dataset
Form2.CrystalReportViewer1.ReportSource = cr
filling or above code sample are both same right..?
Sinisa Hajnal 23-Feb-15 9:15am    
Hm, yes...assuming topdepositor_ind is type name of ReportDocument inheriting class. If that is so, you don't need first New ReportDocument.

The solution above is not for filling your report, but for avoiding loop in creation of dataset.

Sorry for long delay, bad case of flu.
lakshjoshi 24-Feb-15 0:09am    
ok thank you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900