Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a crystal report in my windows vb application with two sub report and 3 datasets.
I have 4 parameters

How do I set parameter to report in code?
Updated 7-Oct-11 0:18am
Dalek Dave 7-Oct-11 6:18am    
Edited for Readability.

1 solution


1 : Go to field Explorer >> right click on Parameter field >> new

2 : Give Proper name and datatype for eg. name:S_DATE datetype:DateTime

3 : declare DateTime variable eg. DateTime A_DATE and now pass it like this

4 : ReportDocument crystalReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

5 : crystalReport.Load(Server.MapPath("filename.rpt";));

6 : crystalReport.SetDatabaseLogon("UserName";"Password";"ServerName";"DataBase name");

7 : crystalReport1.SetParameterValue("S_DATE", A_DATE);

hope this help u
Share this answer
Am Gayathri 23-May-13 1:35am    
how can i add condition here?
eg : if i want to take records for a particular date.

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