DataReader.GetValue -> Unhandled Exception: System.ArgumentOutOfRangeException

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
hansjoergp
Posts: 39
Joined: Wed 31 May 2017 14:33

DataReader.GetValue -> Unhandled Exception: System.ArgumentOutOfRangeException

Post by hansjoergp » Mon 05 Oct 2020 12:57

I have an project where I get always the following exception:

Code: Select all

Unhandled Exception: System.ArgumentOutOfRangeException: Decimal's scale value must be between 0 and 28, inclusive.
Parameter name: scale
   at System.Decimal..ctor(Int32 lo, Int32 mid, Int32 hi, Boolean isNegative, Byte scale)
   at Devart.Data.Oracle.OracleNumberUtils.ToDecimal(Byte[] , Int32 )
   at Devart.Data.Oracle.OracleBufferConverter.GetValue(Byte[] , Int32 , Int32 )
   at Devart.Data.Oracle.OracleDataReader(Int32 )
   at Devart.Data.Oracle.OracleDataReader.GetValue(Int32 i)
Now I have made an test project and it seems that the problem appears only if I make an call to command.Prepare() otherwhise everything works fine

Code: Select all

OracleCommand command = connection.CreateCommand("SELECT TODONEUENTWICKLUNG, TECNOTIZ, TECNOTIZ2, KNDNOTIZ, KNDNOTIZIT, KNDNOTIZEN, KNDNOTIZUEB, PROGNOTIZ, UESTZNOTIZ, FAKTNOTIZ, VERSIONSLISTE, TODOAUFRECHANFUEHREN, TODOAUSLIEFERUNG, TODOBEMERKUNG FROM ADO_TODO_TEST WHERE  todokode = 127986",
                                                                CommandType.Text);

                command.Prepare();

                var reader = command.ExecuteReader(CommandBehavior.SingleResult);
                reader.Read();
                
                reader.Dispose();

                reader = command.ExecuteReader(CommandBehavior.SingleResult);
                reader.Read();
                for (var i = 0; i < reader.FieldCount; i++)
                {
                    var val = reader.GetValue(i);
                }
I use the newest version.
I have send you an test project with the contact formular. There exists an script folder with the table and data definition

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DataReader.GetValue -> Unhandled Exception: System.ArgumentOutOfRangeException

Post by Shalex » Fri 09 Oct 2020 20:19

Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: DataReader.GetValue -> Unhandled Exception: System.ArgumentOutOfRangeException

Post by Shalex » Thu 17 Dec 2020 22:19

The bug with throwing System.ArgumentOutOfRangeException, when OracleCommand.Prepare() has been called before and reader is reused with another query, in the Direct mode is fixed in v9.14.1160: viewtopic.php?f=1&t=44320.

Post Reply