|
-
Aug 23rd, 2007, 04:08 PM
#1
Thread Starter
Junior Member
[Resolved] Passing Multiple Parameters w/CR & VB 2005
Hello
I have searched for how to pass multiple parameters and have found a way but I still get prompted to enter all but one of the multiple parameters. Which ever parameter I add to my parameter list last is the winner, all others I must enter via the prompt dialog. Here's the code:
Code:
Dim paramFields As New CrystalDecisions.Shared.ParameterFields
Dim paramField As New CrystalDecisions.Shared.ParameterField
Dim paramFieldRange As New CrystalDecisions.Shared.ParameterDiscreteValue
Me.crvReportViewer.ReportSource=rptSource
paramField.Name = "@datStart"
paramFieldRange.Value = gdatReportStartDate
paramField.CurrentValues.Add(paramFieldRange)
paramFields.Add(paramField)
MsgBox(paramField.Name.ToString())
paramField.Name = "@datEnd"
paramFieldRange.Value = gdatReportEndDate
paramField.CurrentValues.Add(paramFieldRange)
paramFields.Add(paramField)
paramField.Name = "@txtUser"
paramFieldRange.Value = System.Environment.UserName
paramField.CurrentValues.Add(paramFieldRange)
paramFields.Add(paramField)
Me.crvReportViewer.ParameterFieldInfo = paramFields
Me.crvReportViewer.Refresh()
What I see in the autos window is that paramfields has three items and that all three are exactly the same. I know that this is the issue, but how do I get the paramfields to contain the three different parameters? Does this have something to do with using the ParameterDiscreteValue? Thanks
Last edited by katuil; Aug 23rd, 2007 at 04:34 PM.
-
Aug 23rd, 2007, 04:12 PM
#2
Re: Passing Multiple Parameters w/CR & VB 2005
put this after you add the parameter, before you set the name on the next one.
Code:
paramField = New CrystalDecisions.Shared.ParameterField
What's happening is that you are recylcing the same object, instead of creating new ones.... so each parameter you "add" simply points to the last one by name. By creating a new instance after adding the previous one, the problem should go away.
-tg
-
Aug 23rd, 2007, 04:30 PM
#3
Thread Starter
Junior Member
Re: Passing Multiple Parameters w/CR & VB 2005
Thanks for the obvious. I also found that paramFieldRange was creating a problem as well. I set up three separate parameter field ranges because one was still pushing in the last value into all three parameters.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|