Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

MSSQL Invalid precision value

 Post Reply Post Reply
Author
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Topic: MSSQL Invalid precision value
    Posted: 12 Sep 2019 at 10:41am
Hi,

I face an EAureliusOdbcException with message 'Error -1: [Microsoft][ODBC Driver 11 for SQL Server]Invalid precision value' on a field that is declared as Nullable<Double> on the model and as float at SQL Server (version 2014).

I also tried as Decimal(5,2) but the same happens.

I face the error on every number I insert, even 0.

What I miss here?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 13 Sep 2019 at 4:25pm
Hi,
I cannot reproduce the problem here. Can you maybe try with a different MSSQL driver and/or different SQL Server version to see if it makes a difference?
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 14 Sep 2019 at 12:29pm
How to use different SQL driver? Do you mean use FireDac instead of Native driver?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 15 Sep 2019 at 2:49pm
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 17 Sep 2019 at 7:23am
Please tell me, which driver do you have?
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 17 Sep 2019 at 7:32am
Originally posted by VRACHIOLIS NIKOLAOS

Please tell me, which driver do you have?


Moreover can I use another driver SQL Server let's say SQL Server Native Client ?

Thanks again
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 17 Sep 2019 at 1:28pm
I tested with both "ODBC Driver 13 for SQL Server" and "ODBC Driver 17 for SQL Server", both work. Connecting to both "SQL Server 2017" and "SQL Server 2008". 
SQL Server Native Client should also work.
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2019 at 11:13am
How can I use SQL Server Native client, is there a specific param to use on TAureliusConnection?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 2019 at 12:12pm
You can change global MSSQLOdbcDrivers variable (declared in unit Aurelius.Drivers.MSSQL) and put the driver names you accept to use:

  MSSQLOdbcDrivers := ['SQL Server Native Client 11.0'];



Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 2019 at 1:56pm
It's very strange, its not a driver issue.
When I insert the values saved ok at the database. But If I load and edit them then I get a precision error value.
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 2019 at 5:43pm
Found it the problem was not on a numeric field but at a field nvarchar(max).

When I post and the field was empty the precision error came up, change the field to a varchar(500) and works fine.

Perhaps is a bug on how aurelius manages the specific type.
 
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 2019 at 7:07pm
Can you please provide the exact steps to reproduce the issue?
Back to Top
VRACHIOLIS NIKOLAOS View Drop Down
New Member
New Member
Avatar

Joined: 15 Dec 2018
Posts: 35
Post Options Post Options   Quote VRACHIOLIS NIKOLAOS Quote  Post ReplyReply Direct Link To This Post Posted: 22 Sep 2019 at 3:20pm
Use DataModeler to create a table (MSSQL) that has a field nvarchar(max). I use TAureliusDataset to bind the table to a grid. Create a new record and leave that field empty. If it is saved correctly, make a change on another field and post the changes.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2625
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 23 Sep 2019 at 2:31pm
Still cannot reproduce. Can you please be more specific? Or send a sample project?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down