Results 1 to 2 of 2

Thread: [RESOLVED] Report Parameters in VS2005

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    51

    Resolved [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

  2. #2

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    51

    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")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width