wasi

how we pass parameters to procedure in crystal report using asp.net

Re: Crystal Reports for Visual Studio how we pass parameters to procedure in crystal report asp.net

NewBie To CR

Hi Wasi,

Assuming that the CR is configured in the Aspx.vb / aspx.cs page

you can load parameters in the following manner:

Private Sub LoadCRParameters()

RptViewerMailoutJudgesInvitation.ParameterFieldInfo.Clear()

Dim _paraFeilds As CrystalDecisions.Shared.ParameterFields = New CrystalDecisions.Shared.ParameterFields

Dim _paraCompetitionID As CrystalDecisions.Shared.ParameterField = New CrystalDecisions.Shared.ParameterField

Dim _paraEventID As CrystalDecisions.Shared.ParameterField = New CrystalDecisions.Shared.ParameterField

Dim _paraCompetitionValue As CrystalDecisions.Shared.ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue

Dim _paraEventValue As CrystalDecisions.Shared.ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue

_paraCompetitionID.Name = "@CompID"

_paraCompetitionID.CurrentValues.Clear()

_paraCompetitionValue.Value = Profile.SelComp

_paraCompetitionID.CurrentValues.Add(_paraCompetitionValue)

_paraFeilds.Add(_paraCompetitionID)

_paraEventID.Name = "@EventID"

_paraEventID.CurrentValues.Clear()

_paraEventValue.Value = Profile.SelEvent

_paraEventID.CurrentValues.Add(_paraEventValue)

_paraFeilds.Add(_paraEventID)

RptViewerMailoutJudgesInvitation.ParameterFieldInfo = _paraFeild

End Sub

Here, "RptViewerMailoutJudgesInvitation" is the name of the control which is a CrystalReportViewer

and "@CompID" or "@EventID" are parameter Names which i had created in CR.

These can be anything, and not mandatory to have the '@' Symbol

Hope this helps






Re: Crystal Reports for Visual Studio how we pass parameters to procedure in crystal report asp.net

AJ

Pardon me, i forgot to mention when to call the method.

once, you assign all the Logon Details, to each Report and Subreport, CRTables and CrTable in the reportDocument.Database you can call this method to populate the parameters in the Crystal Reports

If any further details required, i can send more code snippets






Re: Crystal Reports for Visual Studio how we pass parameters to procedure in crystal report asp.net

AJ

as an alternative, you could probably assign the parameter values directly to the Report Document.....

something like

rd.SetParameterValue(" <PARAMETER NAME> ", <VARIABLE VALUE> )

This works too.