PC Review


Reply
Thread Tools Rate Thread

DataSet Limitation?

 
 
=?Utf-8?B?amRu?=
Guest
Posts: n/a
 
      7th Jan 2004
I have a SQL table that has a column defined as Sql Data Type decimal(38,15). In case you are wondering, the precision and scope are that large because it contains 'scientific' numbers which require a range of that size

Anyway, if I try to fill a DataSet with a DataAdapter, with a simple "select * from table", I get

System.OverflowException: Conversion overflow

when it gets to a row that has a column over some value (and I'm sure under some value as well)

For instance: "1000000000000000.000000000000000" produces the erro

Does anyone know what this value is? And is there anyway around this, or is it simply the case that .NET DataSet can't handle a Sql Data Type decimal with a precision and/or scope of that size

TI


 
Reply With Quote
 
 
 
 
=?Utf-8?B?amRu?=
Guest
Posts: n/a
 
      7th Jan 2004
On further review, it looks like the Fill method of the DataAdapter uses int32, which would explain it.

Is there any way around this, that anyone can think of?

jdn
 
Reply With Quote
 
 
 
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      8th Jan 2004
Hi,

This is an know issue, that a "Convertion Overflow" exception will be
thrown if the precision of the decimal field is greater than 28. This will
be fixed in the next version of VS.net. The workaround is to use methods
like SqlDataRead.GetSqlDecimal() to get the decimal values.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

 
Reply With Quote
 
=?Utf-8?B?amRu?=
Guest
Posts: n/a
 
      8th Jan 2004
I am still having problems with it.

If I try to pull over the value "1000000000000000.000000000000000", I get an overflow. I've tried casting it into decimal and long (I would think long should work), but same "Conversion overflow error." And you can't cast SqlDbDecimal into a double.

What should I do?

jdn
 
Reply With Quote
 
=?Utf-8?B?amRu?=
Guest
Posts: n/a
 
      8th Jan 2004
Okay, I got it. You have to do:

"DataReader.GetSqlDecimal[0].ToDouble()"

and then you are good to go. I never understand why the syntax of languages are such that "(double)DataReader.GetSqlDecimal[0]" doesn't work, but there is a method to do it.

I guess there is a method to the madness.

jdn
 
Reply With Quote
 
New Member
Join Date: Jun 2011
Posts: 1
 
      26th Jun 2011
If you don't mind losing some of the decimal accuracy, casting the value returned by the SQL statement as a float also seems to solve the problem.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft Dot NET Framework 3 31st Oct 2003 02:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft Dot NET Framework 2 31st Oct 2003 03:39 AM
Re: copy/move rows from a dataset to another dataset? Stephen Muecke Microsoft ADO .NET 1 22nd Jul 2003 04:56 PM
Re: Merging untyped dataset into a typed dataset (GUID problems) Lewis Edward Moten III Microsoft ADO .NET 0 14th Jul 2003 09:13 PM
GetChanges in a Typed Dataset returns a DataSet?? Paddy Microsoft ADO .NET 1 5th Jul 2003 05:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:55 PM.