Click here to Skip to main content
11,633,515 members (76,816 online)
Rate this: bad
Please Sign up or sign in to vote.
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?
Posted 6-Oct-11 22:41pm
Edited 7-Oct-11 0:18am
Dalek Dave433.2K
Dalek Dave at 7-Oct-11 6:18am
Edited for Readability.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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
Kavitha le at 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)

  Print Answers RSS
0 OriginalGriff 8,618
1 Sergey Alexandrovich Kryukov 8,189
2 Mika Wendelius 6,415
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 2,075

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 7 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100