Page 1 of 1

Decimal's scale Value Error When Filling DataSet

Posted: Wed 19 Mar 2008 23:04
by benbahrenburg
Hello,

I know this has been raised before but what is the best way to deal with fetching columnar data with greater then 29 decimals into a dataset?

Please keep in mind I need to have this dataset "wired" for update to a grid.

Below is a link where I found it was addressed, but I'm still getting the issue in the latest build 4.50.30

http://crlab.com/forums/viewtopic.php?t ... ht=decimal

Posted: Thu 20 Mar 2008 10:34
by Alexey.mdr
Use OracleNumber types in each place of your code,
where you want to get/put values with precision greater than 28.

Posted: Thu 20 Mar 2008 16:46
by benbahrenburg
Switched to the OracleDataTable and everything seemed to work without issue.

Thanks for your help.

Posted: Thu 20 Mar 2008 16:49
by Alexey.mdr
That's great!
Feel free to contact us if you encounter any problems
with OraDirect .NET. Happy programming!

Posted: Thu 03 Apr 2008 01:38
by benbahrenburg
Hello,

Found an interesting issue with the OracelDataTable and large numbers.

If you attempt to the OracleDataTable in the standard way included in the Corelab sample within the documentation and select from the below table you'll get the following message:

Decimal's scale value must be between 0 and 28, inclusive.
Parameter name: scale

I'm using the 4.50.30 build against Oracle 10gR2. Is there a work around for this type of issue, while still using the OracelDataTable since I need to allow the user to update the data through a wired grid.

CREATE TABLE B_TJOTR
(
N FLOAT(126),
V VARCHAR2(10 BYTE)
)
/



SET DEFINE OFF;
Insert into B_TJOTR
(N, V)
Values
(88.1, NULL);
Insert into B_TJOTR
(N, V)
Values
(343, NULL);
Insert into B_TJOTR
(N, V)
Values
(0.00632958471747584, 'FUN');
INSERT INTO B_TJOTR
(N,V)
VALUES
(649301515676727000000000000000000000,'BIGNUMBER');
COMMIT;

Posted: Thu 03 Apr 2008 14:49
by Alexey.mdr
This bug is being fixed now.
Thank you for the bug report.
We will fix it as soon as possible.

Posted: Thu 03 Apr 2008 15:39
by Alexey.mdr
Actually, it's not a bug.
The matter is the following property (you can set it in design time):
OracleDataTable1.ReturnProviderSpecificTypes = true;
And the table will be filled with expected data.

Posted: Thu 03 Apr 2008 22:43
by benbahrenburg
Thanks Alex, that did the trick.

Posted: Fri 04 Apr 2008 00:00
by benbahrenburg
Ran into something interesting when binding to a grid with .ReturnProviderSpecificTypes = True

It seems as though the OracleDate value is throwing an exception.

Is there anyway to fill an OracleDataTable with .ReturnProviderSpecificTypes=true without running into the OracleDate issue below? It is almost like you'd need the ability to select a data type mapping.

Below is the error I get on the bind event.

System.Reflection.TargetInvocationException: Property accessor 'Value' on object 'CoreLab.Oracle.OracleDate' threw the following exception:'Year, Month, and Day parameters describe an un-representable DateTime.' ---> System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.
at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
at CoreLab.Oracle.OracleDate.get_Value()

Posted: Fri 04 Apr 2008 03:49
by benbahrenburg
Hello,

Thanks for all of your help so far with this. After switching .ReturnProviderSpecificTypes = True the table loads. It does seem to have issues with the OracleDate when binding to a grid. That seems to have been an issue in the MS Provider while ago. I've included the link below.

I'm not sure if I'm using this feature correctly.
If I do the following,

_objDataTable = New OracleDataTable
With _objDataTable
.Connection = myConnection
.ReturnProviderSpecificTypes = True
.SelectCommand = MyCommand
.FetchAll = True
.CachedUpdates = True
.Active = False
.Fill()
End With

I now seem to have additional columns in my data grid such as MyColumnName_IsNull, MyColumnName_Lenght, MyColumnName_Value, etc. This also doesn't allow for me to edit the values within a grid on my form. Is there a method that I can use to get large numbers such as 649301515676727000000000000000000000 and still have an object that I can bind for update against a grid ( within a winform ) ?

It seems as though numbers are the only issue I've run into that causes this "Decimal's scale value must be between 0 and 28, inclusive.
Parameter name: scale " issue.

Any help would greatly be appreciated since I really not sure to address this.

Oracle Date Link.

http://kbalertz.com/926357/exception-oc ... table.aspx

Posted: Fri 04 Apr 2008 12:08
by Alexey.mdr
There are some good samples here:
%Program Files%CoreLab\MyDirect.NET2\Samples\WinForms\
If you won't solve the problem please send me (alexeyman*crlab*com) your project to reproduce the problem.
Do not use third party components.