|
|
 |
| Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Crystal Reports section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |
|

January 2nd, 2004, 02:11 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Location: chennai, TamilNadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Passing parameters to crystal reports at runtime
Help me in passing parameters to crystal reports at run time in vb.net with out showing that ugly enter parameter dialog.
Another problem i encountered is when i iterate thro' the data in a data table and filter only a specific data based on a specific field ,i get blank lines for all those fields that were false ie. those that does not satisfy the condition.
Loving,
ßhakee.T
__________________
Loving,
ßhakee.T
|

January 4th, 2005, 05:00 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Location: Agawam, ma, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here's an easy way to pass parameters
' Declare variables needed to pass the parameters to the viewer control.
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
' The first parameter is a discrete parameter with multiple values.
' Set the name of the parameter field, this must match a parameter in the report.
paramField.ParameterFieldName = "@LevyYear"
'*** SETTING THE FIRST DISCRETE VALUE & PASS IT TO THE PARAMETER ***
discreteVal.Value = "Levy Year: " & glbLevyYear
paramField.CurrentValues.Add(discreteVal)
'*** ADDING THE PARAMETER TO THE PARAMETER FIELDS COLLECTION ***
paramFields.Add(paramField)
'*** PASSING A SECOND PARAMETER (DISCRETE VALUE) ***
paramField = New ParameterField
paramField.ParameterFieldName = "@Description"
discreteVal = New ParameterDiscreteValue
discreteVal.Value = "Levy Year: " & glbLevyYear & " | Commitment Number: " & glbCommitNumber
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)
'*** DON'T FORGET TO ALWAYS ADD THE PARAMETER TO THE PARAMFIELDS AFTER ENTERING THE VALUE *** IT MUST BE ADDED AFTER EACH NEW PARAMETER ***
'*** SET THE PARAMETER FIELDS COLLECTION INTO THE VIEWER CONTROL ***
crpViewer.ParameterFieldInfo = paramFields
|

May 25th, 2005, 12:39 PM
|
|
Registered User
|
|
Join Date: Oct 2004
Location: Logan, UT, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So after I have that setup, how do I incorporate that into my report? Where do I put the parameter to use it? Please help! Thanks!
__________________
Brenda
If it weren't for you guys, where would I be?
|

May 26th, 2005, 01:31 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Dear friend: what version of CR & VB u r useing?!
If u use .NET I suggest to use DataSet Fill it with a DataAdapter & then pass DataSet to Report Obj.
But if u still dont want, the given sample is quite OK.
Always:),
Hovik Melkomian.
|

June 1st, 2005, 04:04 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi there..
I use asp.net and crystal 9 for my proj.i facing the prob in passing parameter to crystal report. i tried the above solution on my webpage which contains the crystal report viewer, but i get the incorrect symptom of "[u]Type 'ParameterFields' not defined</u>" , thus i simply cant go forward with trying out the code given above...
Am i on the wrong page??
i tried filling the dataset.the dataset gets filled but again, i am not able to pass the paramater...
what should i do???
|

April 16th, 2006, 03:09 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Location: chennai, TamilNadu, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks sancy2k.
Loving,
ßhakee.T
|

July 14th, 2006, 11:16 PM
|
|
Registered User
|
|
Join Date: Jul 2006
Location: Madison, Wisconsin, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How is this done for Windows Forms? I am trying to print a report and there isn't a viewer and I don't see a method or property ParameterInfo?
|

July 29th, 2006, 03:30 PM
|
|
Registered User
|
|
Join Date: Dec 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi RKevinBurton,
In windows forms you should find a crystal report viewer in the toolbar, should be the last one. Then you'll need to add a New Item to your project (from the solution explorer); you guessed it, a Crystal Report. Set up your crystal report and set the Report Source property of your crystal report viewer to the newly created crystal report (you'll need to browse to its location).
And you'll need this namespace to declare parameter fields:
Code:
CrystalDecisions.Shared
:)Hope this helps!
|

May 21st, 2007, 03:09 AM
|
|
Registered User
|
|
Join Date: May 2007
Location: Delhi, New Delhi, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, My name is Ravish. I am having some problem while passing parameters for crystal report.
my syntax is
cmd.parameters.add("@SLCODE",slcode)
where slcode is an integer at front-end and @SLCODE is varchar in stored procedure.
Actually i am showing this report for every months as I am making payroll system. When I choose March My report opens automatically without any problem. But if I choose April It gives an error "Syntax error converting the varchar value null to coloumn of datatype int".
Also when I checked the syntax "cmd.parameters.add("@SLCODE",slcode)" in immidiate window. Ths syntax gives value "Nothing", but for march this syntax gives value "" (string).
Please if anyone have any idea about this error. do help me.ASAP
Thanks
Regards
RavishDhingra
Ravish Dhingra
|

July 24th, 2008, 04:52 AM
|
|
Registered User
|
|
Join Date: Jul 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try this
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = Convert.ToInt32(TextBox1.Text)
crParameterFieldDefinitions = _
cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("Price")
crParameterValues = crParameterFieldDefinition.CurrentValues
check the following link
http://vb.net-informations.com/cryst...er_integer.htm
leveena
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |