Print Page | Close Window

Passing Parameters through code to Report

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3046
Printed Date: 02 May 2025 at 9:57am


Topic: Passing Parameters through code to Report
Posted By: baselit
Subject: Passing Parameters through code to Report
Date Posted: 28 Apr 2008 at 7:44am
Dear All,
 
How can i pass parameteres (collection) through code to reports?
 
I have connect the report with Stored Procedure and it needs two parameters, how can i set the parameters for them?
 
 
 
Thanks in advance...
Basel
 
 



Replies:
Posted By: jkwrpc
Date Posted: 28 Apr 2008 at 11:49am

There are a number of ways to do what you want. You could create parameters in CR and then pass your values against the parameter collection. I believe you need to make sure the order of your passed values match the order of the parameters. You can use the selection formula and pass the value in using {reportdatafield} = passed parameter1 and {reportdatafield2} = passed parameter1 . You need to make certain the datafields are in the fields you are selecting and the syntax is correct. You could create a SQL select statement in code and pass the variables to it then load the results into a dataset.

I am probably missing other ways, but this will hopefully give you some choices to consider against your report design.
 
Hope this helps.
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net


Posted By: baselit
Date Posted: 28 Apr 2008 at 1:52pm
yeah nearly i have understand what you mean.
 
 
but can you please provide me with a sample code of this, because really i'm new on Crystal Rports.


Posted By: medmondson
Date Posted: 07 May 2008 at 7:28am
The following article shows an easy method of accomplishing this task:
 
http://www.codeproject.com/KB/vb/CrystalContrl.aspx - http://www.codeproject.com/KB/vb/CrystalContrl.aspx
 


-------------
I dream of .Net!



Print Page | Close Window