473,479 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 10932
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
6097
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
3953
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
1158
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
2165
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
623
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
1391
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
1328
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
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5312
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2980
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.