Parameter to Stored Procedure CR 8.5 VB.Net Specified Cast Not Valid 
Author Message
 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



Sat, 19 Nov 2005 01:01:45 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB.NET: Specified cast is not valid.

2. Specified cast is not valid: Web._default.Page_Load - ASP.NET Website Programming sample

3. Specified cast is not valid

4. Specified cast is not valid

5. Specified cast not valid

6. specified cast is not valid

7. Specified cast is not valid - MS Please help

8. Specified cast not valid

9. CR 8.5 viewer not working in VB .NET??

10. ANS: stored procedure error via ADO to CR 8.5

11. Crystal 8.5 - troubles with passing strings as stored procedure parameters

12. Stored procedure parameter with Crystal Report 8.5

 

 
Powered by phpBB® Forum Software