473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Specified cast not valid on decimal & double datatypes

I have a variable that is part of my dataset (a double int datatype),
and I need to use this variable in an ItemDataBound for a datagrid.
When debugging and looking at the StackTrace, the Specified cast not
valid error is pointing to my double int that i need to assign to
'price' , which was declared as a Decimal in my ItemDataBound function:

Decimal price;
price = (Decimal)(rowData["dblTotalVolume"]);

the price variable will be used on my datagrid as a totals figure when
adding up a datagrid column , so I'm using it in an ItemDataBound
function. I'm wondering how to change dbleTotalVolume so I can use it
in this context.
Thanks
netsports

Nov 17 '05 #1
3 10916
Does

System.Convert.ToDecimal(rowData["dblTotalVolume"]);

work?

".Net Sports" <ba********@cox.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
I have a variable that is part of my dataset (a double int datatype),
and I need to use this variable in an ItemDataBound for a datagrid.
When debugging and looking at the StackTrace, the Specified cast not
valid error is pointing to my double int that i need to assign to
'price' , which was declared as a Decimal in my ItemDataBound function:

Decimal price;
price = (Decimal)(rowData["dblTotalVolume"]);

the price variable will be used on my datagrid as a totals figure when
adding up a datagrid column , so I'm using it in an ItemDataBound
function. I'm wondering how to change dbleTotalVolume so I can use it
in this context.
Thanks
netsports

Nov 17 '05 #2
that looks like what i need for the moment. Thanks a ton!!
netsports

Nov 17 '05 #3
why not:

double price;
price = (double) (rowData["dblTotalVolume"]);

".Net Sports" wrote:
that looks like what i need for the moment. Thanks a ton!!
netsports

Nov 17 '05 #4

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

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
5
by: .Net Sports | last post by:
I have a datagrid codebehind script that takes data from sql dbase and displays it in a footer row as a total. One column has amount_dollars (which works fine), while another has new sales (which...
3
by: .Net Sports | last post by:
I have a variable that is part of my dataset (a double int datatype), and I need to use this variable in an ItemDataBound for a datagrid. When debugging and looking at the StackTrace, the Specified...
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...
1
by: .Net Sports | last post by:
I have a datagrid codebehind script that takes data from sql dbase and displays it in a footer row as a total. One column has amount_dollars (which works fine), while another has new sales (which...
1
by: .Net Sports | last post by:
IN a datagrid code behind, I'm getting a "Specified cast is not valid" error price = (Decimal)(rowData); which was initialized as: Decimal price;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.