Problem passing parameters to crystal report

Bill Humphrey

Active member
Joined
Apr 10, 2008
Messages
35
Programming Experience
Beginner
I keep getting the following error when trying to pass parameters to a crystal report. I'm using VS 2003 and CR developer edition V.11. The parameters are @sdt_start and @sdt_end

Server Error in '/CRNETSamples/vbnet_web_discreteparams' Application.
--------------------------------------------------------------------------------

Missing parameter field current value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter field current value.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ParameterFieldCurrentValueException: Missing parameter field current value.]
.F(String  , EngineExceptionErrorID 
)
.B(String , Int32 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.internalSetReportInfo(RequestContext reqContext)
CrystalDecisions.CrystalReports.Engine.FormatEngine.internalGetViewContext(ReportPageRequestContext reqContext, * viewContext)
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.u(Boolean N)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()

My code to ope the report is:

VB.NET:
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init


        ''*** CODEGEN: This method call is required by the Web Form Designer
        ''*** Do not modify it using the code editor.
        InitializeComponent()

        ''Create an instance of the strongly-typed report object
        crReportDocument = New KPIConveyance2

        ''*** The viewer's reportsource must be set to a report before any
        ''*** parameter fields can be accessed.
        CrystalReportViewer1.ReportSource = crReportDocument

        ''*** Get the collection of parameters from the report
        crParameterFields = CrystalReportViewer1.ParameterFieldInfo

        ''*** Access the specified parameter from the collection
       crParameterField = crParameterFields.Item("@sdt_start")


        ''*** Get the current values from the parameter field.  At this point
        ''*** there are zero values set.
        crParameterValues = crParameterField.CurrentValues

        ''*** Set the current values for the parameter field
        crParameterDiscreteValue = New ParameterDiscreteValue
        crParameterDiscreteValue.Value = "01/01/2008"

        ''*** Add the first current value for the parameter field
        crParameterValues.Add(crParameterDiscreteValue)

        '******************************************************
        'param 2
        '******************************************************

        crParameterField = crParameterFields.Item("@sdt_end")

        ''Get the current values from the parameter field.  At this point
        ''there are zero values set.
        crParameterValues = crParameterField.CurrentValues

        ''Set the current values for the parameter field
        crParameterDiscreteValue = New ParameterDiscreteValue
        crParameterDiscreteValue.Value = "01/03/2008"

        ''Add the first current value for the parameter field
        'crParameterValues.Add(crParameterDiscreteValue)
  End Sub
 
Last edited by a moderator:
Back
Top