
Parameter to Stored Procedure CR 8.5 VB.Net Specified Cast Not Valid
Hello,
I am ready to jump off nearest cliff - any suggestions appreciated.
I have crystalreportviewer (crvForecast) on webform. The report was
created in CR8.5. It uses a SQL Server stored procedure that takes one
the stored procedure and just executing the reportsource line works.
The error does not occur on any specific line - in fact I can walk
through each line with no error - error seems to be generated within
crystal (ug!). Further investigation yielded an error on
.parameterfieldinfo.item(0) - again "specified cast item(get_index) -
not valid"? How can 0 not be valid index cast?? Watching the locals
values on debug nothing seems out of whack! HELP!! Any known bugs or
patches?? (she says desperately!)
Following code is called by button click:
Dim sReport As String
sReport = "c:\Inetpub\wwwroot\reports\forecast.rpt"
' Declare variables needed to pass the parameters to the viewer
control
Dim paramFields As New ParameterFields()
Dim paramField As New ParameterField()
Dim discreteVal As New ParameterDiscreteValue()
' Set the name of parameter field
' Set the first discrete value and pass it to the parameter
discreteVal.Value = 1
paramField.CurrentValues.Add(discreteVal)
'Add the parameter to the parameter fields collection.
paramFields.Add(paramField)
With crvForecast
.ParameterFieldInfo = paramFields
.ReportSource = sReport
End With
error message:
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: System.InvalidCastException: Specified cast is not
valid.
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:
[InvalidCastException: Specified cast is not valid.]
CrystalDecisions.Shared.ReportStateInfo..ctor(ReportStateInfo
reportStateInfo)
CrystalDecisions.Shared.RequestContext..ctor(RequestContext
requestContext)
CrystalDecisions.Shared.ReportPageRequestContext..ctor(ReportPageRequestContext
requestContext)
CrystalDecisions.Shared.PageRequestContext..ctor(PageRequestContext
pageRequestContext)
CrystalDecisions.Web.ReportAgent.v(Boolean `)
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()
- THANK YOU!!
kelly