Print Page | Close Window

Help Needed in passing parameter

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=14139
Printed Date: 03 May 2025 at 2:21pm


Topic: Help Needed in passing parameter
Posted By: Vamp10988
Subject: Help Needed in passing parameter
Date Posted: 20 Aug 2011 at 7:37pm
Hello everyone, I am trying to create a report for a single record and as such am trying to pass parameters to a crystal report but I am not sure exactly how to do this. This is my own method that I am employeeing. I do not want to create a data table and put all the info I need in there and then base a report off of it. I do not want to deal with loops and arrays right now. I just want to pass for example parameter JuvenileID = 1 to my crystal report, then create a command under the database expert and set the parameter for my command to the parameter I passed my crystal report. How would I go about in doing this? I am using VS 2010 C#. This is a windows application. I have a dataentry form that is already populated with the info needed for the report. I just need to pass all the controls.text values to the report and populate it that way.



Replies:
Posted By: jkwrpc
Date Posted: 22 Aug 2011 at 7:20am
I dont have  the code in front of me but there are a couple of ways to approach what you want.
 
The first is parameters are a collection in CR so you  can refer to the parameters by their name or index and assign the value of the VS control to parameter. You do need to take care with the data types so as to avoid the mismatch error.
 
The second way would be to create your report and populate it with report items such as textboxes. You can give these items names perhaps to match your VS naming conventions. The text controls can be referenced,  I believe within the report defintions class, then pass the value into the controls. Keep in mind that that the report definitions are a reflection of the report design, so specific reference should be made to controls within the header, group headers and footers, detail sections, etc. 
 
I am sorry I dont have sample code to offer with me, perhaps someone can provide or add more clarity to what I have presented.
 
Hope this is of some help.
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net
 
 
 
 
 



Print Page | Close Window