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

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
luckyday1201
Posts: 2
Joined: Tue 14 Mar 2017 09:23

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

Post by luckyday1201 » Tue 14 Mar 2017 09:40

Hello, I have a question.

When I use pgsqlConnection and pgsqlCommand
like following

...
DbConnection conn = new PgSqlConnection(connStr);
DbCommand command= new PgSqlCommand(SPName, conn as PgSqlConnection);

....
and use DbDataReader

using (DbDataReader Odbcdr = command.ExecuteReader())
{
PARAM_VALUE = dr[valueColName] == DBNull.Value ? 0 : Convert.ToDouble(dr[valueColName]),
}

and read like upper code.

but I face a error like this.




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

at Devart.Data.PostgreSql.j.aq(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.b.az(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Common.ap.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.b.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.j.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.PgSqlDataReader.GetValue(Int32 i)
at Devart.Common.DbDataReaderBase.get_Item(String name)
at KH.SWP.Server.BigDataApp.BigDataService.CreateERDViewValueItem(DbDataReader dr, String erdIndexColName, String lslColName, String uslColName, String valueColName, Int32 index) in C:\code workplace\2.11.170118_Chart_Server_Lee\AllInOne\KH.SWP\KH.SWP.EES.Server\KH.SWP.Server.BigDataApp\BigDataService.svc.cs:line 1042
at KH.SWP.Server.BigDataApp.BigDataService.InitGPTwoModel_ERDTSUM(DbDataReader dr, ObservableCollection`1 BaseInfo) in C:\code workplace\2.11.170118_Chart_Server_Lee\AllInOne\KH.SWP\KH.SWP.EES.Server\KH.SWP.Server.BigDataApp\BigDataService.svc.cs:line 511


I know data is more than 28 size.
I can round, but When reading , It is faced error.
So I want to know How to read and round this data.

I try like following.
But it is same.

double dParmaValue = 0.0;
Double.TryParse(dr[valueColName].ToString(), out dParmaValue);


Please give me advice.
Thank you for your help.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

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

Post by Pinturiccio » Wed 15 Mar 2017 16:18

Please try using the latest (7.7.852) version of dotConnect for PostgreSQL. It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only).

Is the issue reproduced with the latest version?

luckyday1201
Posts: 2
Joined: Tue 14 Mar 2017 09:23

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

Post by luckyday1201 » Thu 16 Mar 2017 06:32

Hello,
First of all, Thank you for response.

I used dotConnect for PostgreSql 7.7.852 trial version
(Devart.Data.dll and Devart.Data.PostgreSql.dll)

But error is same

at Devart.Data.PostgreSql.c.ar(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.y.a1(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Common.al.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.y.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.c.k(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.PgSqlDataReader.GetValue(Int32 i)
at Devart.Common.DbDataReaderBase.get_Item(String name)
at KH.SWP.Server.BigDataApp.BigDataService.CreateERDViewValueItem(DbDataReader dr, String erdIndexColName, String lslColName, String uslColName, String valueColName, Int32 index) in C:\code workplace\2.11.170118_Chart_Server_Lee\AllInOne\KH.SWP\KH.SWP.EES.Server\KH.SWP.Server.BigDataApp\BigDataService.svc.cs:line 1056
at KH.SWP.Server.BigDataApp.BigDataService.InitGPTwoModel_ERDTSUM(DbDataReader dr, ObservableCollection`1 BaseInfo) in C:\code workplace\2.11.170118_Chart_Server_Lee\AllInOne\KH.SWP\KH.SWP.EES.Server\KH.SWP.Server.BigDataApp\BigDataService.svc.cs:line 511


Can you give me more advice?
Thank you very much.

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

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

Post by Shalex » Thu 16 Mar 2017 09:05

Please send us a small test project with the corresponding DDL/DML script for reproducing the issue in our environment.

Post Reply