This is a migrated thread and some comments may be shown as answers.

confusing Parameter Integer Type ??

2 Answers 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Khanh Nguyen
Top achievements
Rank 1
Khanh Nguyen asked on 12 Feb 2010, 12:05 AM
when designing in my  own report class library,  sample.dll  so it can be used in my webapp,

the Integer Parameter  needs to be (Int64) or else I would get cast error.

           Int64 territoryId = (Int64)this.ReportParameters["TerritoryId"].Value; 
 

When the setting is Int64, i can click Preview and report comes up via the class library.  If it's set to int,

An error has occured while processing Chart 'chart1':
Specified cast is not valid.





But when I add this reference to my webapp to use the ReportViewer,
it doesn't like Int64 and gives the cast error, I debug in VS and see it's this line, so  I change it to  int, it works.
int territoryId = (int)this.ReportParameters["TerritoryId"].Value; 




I don't think this is what supposed to happen?
They are both .Net 3.5, the class and webapp are even in the same solution.
I'm using  Telerik Reporting Q3 2009  v. 3.2.9.1211  Trial

2 Answers, 1 is accepted

Sort by
0
Massimiliano Bassili
Top achievements
Rank 1
answered on 12 Feb 2010, 03:14 PM
Try the Convert.ToInt64 method instead of direct cast, since with the direct cast (int64) you're loosing accuracy - thus the error.

Cheers!
0
Khanh Nguyen
Top achievements
Rank 1
answered on 13 Feb 2010, 02:14 AM
the Convert.ToInt64  worked. thanks! :)


Tags
General Discussions
Asked by
Khanh Nguyen
Top achievements
Rank 1
Answers by
Massimiliano Bassili
Top achievements
Rank 1
Khanh Nguyen
Top achievements
Rank 1
Share this question
or