Hi Florencio,
In looking at your code, you Dim paramNew As New but never use this variable until you Dim as New again in the For Each loop. You should remove the first New and just Dim the variable. I would check the other variables also to make sure you aren't Dimming them as New without using them before you Dim it again as New.
Also, here is a link to the on-line help which provides sample code on how to set this up:
ms-help://MS.VSCC/MS.MSDNVS/crystlmn/html/crtskparameterfieldsruntimecustomization.htm
>Hi All
>
>Just wanna ask on how to pass parameters on a Crystal Reports on a ASP.Net
>platform. I have made a sample code that passes parameters but it seems that it doesn't follow it. Ive checked my stored procedures and it works
>pretty well. Here are my codes:
>
>
> Dim params As New CrystalDecisions.Shared.ParameterFields()
> Dim param As New CrystalDecisions.Shared.ParameterField()
> Dim paramNew As New CrystalDecisions.Shared.ParameterField()
> Dim discreteVal As New CrystalDecisions.Shared.ParameterDiscreteValue()
> Dim paramValues As New CrystalDecisions.Shared.ParameterValues()
>
>
> Dim logOnInfo As New CrystalDecisions.Shared.TableLogOnInfo()
> Dim logOnInfoNew As New CrystalDecisions.Shared.TableLogOnInfo()
> Dim logOnInfos As New CrystalDecisions.Shared.TableLogOnInfos()
>
> Dim inParameter As Integer
> Dim vrParameters(1)
>
> vrParameters(0) = "1/1/2003 0:0:0"
> vrParameters(1) = "2/15/2003 0:0:0"
>
> CRView.ReportSource = "c:\InetPub\wwwRoot\CrystalDotNet\Reports\LinxAuditReport.rpt"
>
>
> For Each param In CRView.ParameterFieldInfo
> paramNew = New CrystalDecisions.Shared.ParameterField()
> paramNew.ParameterFieldName = param.ParameterFieldName
> If inParameter < vrParameters.Length Then
> discreteVal.Value = vrParameters(inParameter)
> End If
> paramValues.Add(discreteVal)
> paramNew.CurrentValues = paramValues
> params.Add(paramNew)
> inParameter = inParameter + 1
> Next
> CRView.ParameterFieldInfo = params
>
> For Each logOnInfo In CRView.LogOnInfo
> logOnInfoNew = New CrystalDecisions.Shared.TableLogOnInfo()
> logOnInfoNew.TableName = logOnInfo.TableName
> logOnInfoNew.ConnectionInfo.ServerName = "bmman2k047"
> logOnInfoNew.ConnectionInfo.DatabaseName = "LINXGATEWAY"
> logOnInfoNew.ConnectionInfo.UserID = "devuser"
> logOnInfoNew.ConnectionInfo.Password = "user1"
> logOnInfos.Add(logOnInfoNew)
> Next
> CRView.LogOnInfo = logOnInfos
>
> DataBind()
>
>Thanks in Advance
>
>Florencio
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi