Value was too large or small for a decimal
-
Hi... I have a value in oracle DB like "3.50324616E-38".. when I read this value from db in Vc.net using odbcDataReader I get an error like "Value was too large or small for a decimal".. The error is encountered in thi line varname = RdrIns->default::get(row+icnt) ; i tried many methods of Datareader..like .Getint32, GetInt64 GetDecimal etc.. no use any help.???
Salai
-
Hi... I have a value in oracle DB like "3.50324616E-38".. when I read this value from db in Vc.net using odbcDataReader I get an error like "Value was too large or small for a decimal".. The error is encountered in thi line varname = RdrIns->default::get(row+icnt) ; i tried many methods of Datareader..like .Getint32, GetInt64 GetDecimal etc.. no use any help.???
Salai
-
Yaa I tried.... tried all the methods supported by the OdbcDataReader...
Salai
-
Hi... I have a value in oracle DB like "3.50324616E-38".. when I read this value from db in Vc.net using odbcDataReader I get an error like "Value was too large or small for a decimal".. The error is encountered in thi line varname = RdrIns->default::get(row+icnt) ; i tried many methods of Datareader..like .Getint32, GetInt64 GetDecimal etc.. no use any help.???
Salai
It doesn't work because of exactly what the error message says. The smallest value a Decimal type can have is (+/-)1E-28. You're trying the move the decimal point 10 places more to the left than the Decimal type can handle.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
It doesn't work because of exactly what the error message says. The smallest value a Decimal type can have is (+/-)1E-28. You're trying the move the decimal point 10 places more to the left than the Decimal type can handle.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Thanks Dave... I understud... Is there any other method to handle this data.. The datatype of that column in Oracle is Binary_FLoat. While oracle can store that data why cant .Net access that data??.. I tried with Rdr->GetData Rdr->GetDecimal Rdr->Getint16,32 Rdr->GetDouble Rdr->GetFloat etc.... Nothing works...
Salai
-
Thanks Dave... I understud... Is there any other method to handle this data.. The datatype of that column in Oracle is Binary_FLoat. While oracle can store that data why cant .Net access that data??.. I tried with Rdr->GetData Rdr->GetDecimal Rdr->Getint16,32 Rdr->GetDouble Rdr->GetFloat etc.... Nothing works...
Salai
salaikumar wrote:
While oracle can store that data why cant .Net access that data??
Was .NET written by Oracle?? No. There's nothing that says Microsoft has to support every feature of every database or anything else that might come .NETs way. You have to use the Double data type to store the value. It's range is (copied from MSDN documentation): -1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values; 4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
salaikumar wrote:
While oracle can store that data why cant .Net access that data??
Was .NET written by Oracle?? No. There's nothing that says Microsoft has to support every feature of every database or anything else that might come .NETs way. You have to use the Double data type to store the value. It's range is (copied from MSDN documentation): -1.79769313486231570E+308 through -4.94065645841246544E-324 † for negative values; 4.94065645841246544E-324 through 1.79769313486231570E+308 † for positive values
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Thanks Dave.. When I tried with double, it returns error for other columns..(Since it is a generic function). Atlast I handled this problem by having a try catch with over flow exception and replaced this value with zero to display in reports since this value is very small.. Thanks for your concern to reply.
Salai