Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

i want to know how to set paramater of Crystal Report in C# . and this parameter i want to set in Loop.

when i use :
cr.SetParameterValue(0, ds.Tables[0].Rows[0][1].ToString());
cr.SetParameterValue(1, company_name);
cr.SetParameterValue(2, database_name);

this will display only one record but i want to display more record .

Thanks in Advance.
Updated 25-Jun-12 0:53am
Erik Rude 25-Jun-12 16:14pm    
I don't know Crystal Reports, but maybe if you can work out what the [0][1] in
cr.SetParameterValue(0, ds.Tables[0].Rows[0][1].ToString());
means then you could be on to a winner?
Kschuler 25-Jun-12 17:19pm    
This doesn't make a whole lot of sense. Typically paramters are used in a report just once. You can't add the SAME parameter multiple times. You could create a new report with different parameter values. Is that what you want? If not, then you probably need to redesign your report so that the data isn't filtered as much and you will see the records you want.
[no name] 26-Jun-12 0:12am    
if i pass two code into report, the report must show that two report name.and i have three parameter used in report. so when i use query it execute for only once not for second. so what can i do to print both that records in Report ?
Please Help Me...

1 solution

If You want to print multiple time same value then set datatable to source. And then print those field in detail section.
Crystal report not support dynamically parameter. Once you add parameter in crystal report that parameter you have to pass.
In your case you want to set it using loop. your datatable contain many record so you have to set it as source and print it in detail section.
Other wise give me your exact definition what you want to print. So i can help you..
Share this answer
[no name] 26-Jun-12 0:37am    
how i set datatable value in detail section.
Savalia Manoj M 26-Jun-12 0:48am    
Set report source as Datatable and then print field on report.
[no name] 26-Jun-12 1:14am    
Thank you very much brother.........

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