472,992 Members | 3,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

Specified Cast is not Valid (Crystal)

Since upgrading to .Net 2003, when I run report reports within an application
using CrystalReportViewer, I'm getting the error "Specified Cast is not
Valid". A value is being passed into the report.
Jul 21 '05 #1
4 2879
Hi Andy,

How are you defining the parameter that you are passing into the report?
Let us see the code.

Bernie Yaeger

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
Since upgrading to .Net 2003, when I run report reports within an
application
using CrystalReportViewer, I'm getting the error "Specified Cast is not
Valid". A value is being passed into the report.

Jul 21 '05 #2
Hi Bernie

I have an opening form, the variable is populated by a combo box. I produce
the report by pressing a button to open the CrystalReportViewer. The report
is generated using a SQL Stored Procuedure.

Module module1

Public div As Integer

End Module
This is code I’ve input in the CrystalReportViewer

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

Dim parameterfields As CrystalDecisions.Shared.ParameterFields
Dim parameterfield As CrystalDecisions.Shared.ParameterField
Dim spvalue As CrystalDecisions.Shared.ParameterDiscreteValue
parameterfields = New CrystalDecisions.Shared.ParameterFields
parameterfield = New CrystalDecisions.Shared.ParameterField
parameterfield.ParameterFieldName = "@div"
spvalue = New CrystalDecisions.Shared.ParameterDiscreteValue
spvalue.Value = div
parameterfield.CurrentValues.Add(spvalue)
parameterfields.Add(parameterfield)
CrystalCountSheets.ParameterFieldInfo = parameterfields

Andy
"Bernie Yaeger" wrote:
Hi Andy,

How are you defining the parameter that you are passing into the report?
Let us see the code.

Bernie Yaeger

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
Since upgrading to .Net 2003, when I run report reports within an
application
using CrystalReportViewer, I'm getting the error "Specified Cast is not
Valid". A value is being passed into the report.


Jul 21 '05 #3
OK; I've got the code - I'll be out of town a few days but I'll take a look
at it when I return.

Bernie

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
Hi Bernie

I have an opening form, the variable is populated by a combo box. I
produce
the report by pressing a button to open the CrystalReportViewer. The
report
is generated using a SQL Stored Procuedure.

Module module1

Public div As Integer

End Module
This is code I've input in the CrystalReportViewer

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

Dim parameterfields As CrystalDecisions.Shared.ParameterFields
Dim parameterfield As CrystalDecisions.Shared.ParameterField
Dim spvalue As CrystalDecisions.Shared.ParameterDiscreteValue
parameterfields = New CrystalDecisions.Shared.ParameterFields
parameterfield = New CrystalDecisions.Shared.ParameterField
parameterfield.ParameterFieldName = "@div"
spvalue = New CrystalDecisions.Shared.ParameterDiscreteValue
spvalue.Value = div
parameterfield.CurrentValues.Add(spvalue)
parameterfields.Add(parameterfield)
CrystalCountSheets.ParameterFieldInfo = parameterfields

Andy
"Bernie Yaeger" wrote:
Hi Andy,

How are you defining the parameter that you are passing into the report?
Let us see the code.

Bernie Yaeger

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
> Since upgrading to .Net 2003, when I run report reports within an
> application
> using CrystalReportViewer, I'm getting the error "Specified Cast is not
> Valid". A value is being passed into the report.


Jul 21 '05 #4
Hi Andy,

I could not duplicate your code in a test app because I do not know what
'crystalcountsheets' is.

Let's see if I can help another way. Here's how I pass parameters to a
crystal report through vb .net:
Dim paramFields As New ParameterFields

Dim paramField As New ParameterField

Dim paramField2 As New ParameterField

Case "f:\imcapps\histdeff.rpt"

paramField.ParameterFieldName = "pstartbox" ' the name of one parameter in
the report

paramField2.ParameterFieldName = "pendbox" ' the name of one parameter in
the report

discreteVal.Value = Me.mmcomment1

discreteVal2.Value = Me.mmcomment2

paramField.CurrentValues.Add(discreteVal)

paramField2.CurrentValues.Add(discreteVal2)

paramFields.Add(paramField)

paramFields.Add(paramField2)

CrystalReportViewer1.ParameterFieldInfo = paramFields

connectionchange()

I first assign the two parameter names in the report to a parameterfield
variable. I then assign values to discreteval and discreteval2. I then
make those the currentvalues of the parameter variables; then they are added
to the parameterfields collection; finally, I add the parameterfields
collection to the viewer's parameterfieldinfo. Connectionchange() simply
changes pwds, logins, etc and run the report document object.

HTH,

Bernie

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:e6*************@TK2MSFTNGP09.phx.gbl...
OK; I've got the code - I'll be out of town a few days but I'll take a
look at it when I return.

Bernie

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
Hi Bernie

I have an opening form, the variable is populated by a combo box. I
produce
the report by pressing a button to open the CrystalReportViewer. The
report
is generated using a SQL Stored Procuedure.

Module module1

Public div As Integer

End Module
This is code I've input in the CrystalReportViewer

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

Dim parameterfields As CrystalDecisions.Shared.ParameterFields
Dim parameterfield As CrystalDecisions.Shared.ParameterField
Dim spvalue As CrystalDecisions.Shared.ParameterDiscreteValue
parameterfields = New CrystalDecisions.Shared.ParameterFields
parameterfield = New CrystalDecisions.Shared.ParameterField
parameterfield.ParameterFieldName = "@div"
spvalue = New CrystalDecisions.Shared.ParameterDiscreteValue
spvalue.Value = div
parameterfield.CurrentValues.Add(spvalue)
parameterfields.Add(parameterfield)
CrystalCountSheets.ParameterFieldInfo = parameterfields

Andy
"Bernie Yaeger" wrote:
Hi Andy,

How are you defining the parameter that you are passing into the report?
Let us see the code.

Bernie Yaeger

"Oldhandandy" <Ol*********@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
> Since upgrading to .Net 2003, when I run report reports within an
> application
> using CrystalReportViewer, I'm getting the error "Specified Cast is
> not
> Valid". A value is being passed into the report.


Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tao | last post by:
I just upgraded .NET framework to 1.1 and VS.Net to 2003 version and tried to test it out. I created an ASP.NET project using the wizard and tried to run it by hitting "F5". I got an exception:...
0
by: Omavlana | last post by:
Hi, I am getting the above error "specified cast is not valid" while sending the parameter to crystal report through VB.NET. Here is my code.. '*********** Dim paramFields As New...
1
by: Ron Holmes | last post by:
I posted this question on the Crystal Reports Support site and I am still waiting for an answer. Using Crystal Reports 9.0 Developer Full edition: My Crystal report .RPT file has a Picture box...
3
by: PK9 | last post by:
I am looking for assistance in pinpointing the cause of the following exception. I am getting a "Specified Cast is not valid" exception on my page. I am trying to populate a datagrid. One of my...
2
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: ...
3
by: VB Programmer | last post by:
I am setting up forms authentication. In my code I keep getting this error. Any ideas? Error.... Server Error in '/LandOLots' Application....
0
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is...
0
by: Alan Z. Scharf | last post by:
this question in datagrid group for several days with no repsonse. I'm hoping for an answer her because of greater activity in this group. No cross-posting intended. Thanks....
4
by: Oldhandandy | last post by:
Since upgrading to .Net 2003, when I run report reports within an application using CrystalReportViewer, I'm getting the error "Specified Cast is not Valid". A value is being passed into the report.
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.