[RESOLVED] Report Parameters in VS2005
Hi,
I'm hoping someone can help with a problem I have. I had a windows app built in BV.Net using Visual Studio 2003 and Crystal Reports XI and it was passing parameters to reports using the code example below.
Code:
Dim parameters As New ParameterFields
Dim parameter As New ParameterField
Dim paramvalue As New ParameterDiscreteValue
parameter.ParameterFieldName = "@TradeRef"
paramvalue.Value = frmTradeRef.ParamTRef
parameter.CurrentValues.Add(paramvalue)
parameters.Add(parameter)
CrystalReportViewer1.ParameterFieldInfo = parameters
CrystalReportViewer1.ReportSource = crReportDocument
Obviously there was more code invovled but but the above is the parameter part.
We have now upgraded to Visual Studio 2005 Pro and the above code no longer works and an error message is being returned stating that the report was expecting parameter @TradeRef which wasn't received.
Does anyone know the code I now require to get this to work.
Thanks in advance
Re: Report Parameters in VS2005
Solved using the code snippets.
Code:
Dim parameterField As ParameterField
Dim parameterField1 As ParameterField
Try
crReportDocument.Load("" & strRptPath & "" & strRptName & ".rpt")
Catch
MsgBox("Report: " & strRptName & ".rpt Not Found",MsgBoxStyle.Information)
End Try
parameterField = crReportDocument.ParameterFields("What Value/Settlement Date?")
parameterField.CurrentValues.AddValue(CDate("2007.02.27"))
parameterField1 = crReportDocument.ParameterFields("Cash or Non-Cash Trades (Y/N)")
parameterField1.CurrentValues.AddValue("Y")