Page 1 of 2

Invalid Precision Value when using parameters

Posted: Thu 13 Feb 2014 23:10
by arusoft
We are using ODBC connection for SQL Server. We have simple code with sql that has parameter , For example

uniQUERY.sql.text := 'select * from Table where Filed1 = :FieldValue';
uniQUERY.params[0].value := CheckListBox1.items[CheckListBox1.itemindex];
uniQUERY.active := true;

When I tried to set active := true, we are getting Invalid Precision error
[Microsoft][ODBC SQL Server Driver]Invalid Precision value.

The problem is that we cannot reproduce this locally. Its only happening on clients enviornment. SQL Server is 2008.

We are using uniDAC 4.6.11.

Pleas advice.

Thank You.

Re: Invalid Precision Value when using parameters

Posted: Mon 17 Feb 2014 11:31
by AlexP
Hello,

To solve the problem, try to specify explicitly the type and size of the parameter before assigning a value to it.

Re: Invalid Precision Value when using parameters

Posted: Mon 17 Feb 2014 15:55
by arusoft
Thanks for reply Alex. But the questions is why can't we reproduce this locally. Why is this happening only for client. Is there some database setting that controls this.

Also for the same client when we try to log to SQL server through ODBC its forcing to do direct connect by showing the direct connect login window even though we are not calling. But again this is not the case at our end.

Thank You.

Re: Invalid Precision Value when using parameters

Posted: Tue 18 Feb 2014 09:22
by AlexP
Most probably, both problems are due to the used ODBC driver. The first one is due to the BindParam ODBC method, the second problem can't be reproduced. Please make sure that the same ODBC driver version is used on your and client computers.

Re: Invalid Precision Value when using parameters

Posted: Tue 18 Feb 2014 22:15
by arusoft
ALex I asked the client exactly the same question and waiting for answer. Is there any know issues or recommendations from your side on ODBC driver version?

Thanks.

Re: Invalid Precision Value when using parameters

Posted: Wed 19 Feb 2014 08:53
by AlexP
To have access to the server, you should use not an ODBC driver, but the Native Client (or OLEDB) with the provider for SQL Server ( SQLServerUniProvider ). If you are using an ODBC provider, then this provider must be compatible with the used server version.

Re: Invalid Precision Value when using parameters

Posted: Wed 19 Feb 2014 14:16
by arusoft
We are just using tUniConnection.

If a user uses sql server authentican then
UniConnection1.ProviderName := 'SQL Server';
UniConnection1.Server := SQLServerName;
UniConnection1.database := SQLServerDatabaseName;
UniConnection1.Username := SQLServerUsername;
UniConnection1.Password := SQLServerPassword;

But if a user chose ODBC then we use this
UniConnection1.SpecificOptions.Clear;
UniConnection1.SpecificOptions.Add('Authentication=auWindows');
UniConnection1.Connected := true;

Please let me know if you would recommend otherwise.


Thank You.

Re: Invalid Precision Value when using parameters

Posted: Fri 21 Feb 2014 11:51
by AlexP
When using ODBCUniprovider, specific settings for each database are unavailable (there is no Authentication option). Such settings must be set on creation of DSN in ODBC Data Source Administrator. We recommend to use SQLServerUniProvider for work with SQL Server, since it allows to configure connection parameters and DataSet more flexibly, as well as to use various SQL Server clients and requires no additional settings of DSN.

Re: Invalid Precision Value when using parameters

Posted: Mon 24 Feb 2014 20:59
by arusoft
So we got reply from client with screen shots and we are seeing that they have same ODBC driver version at there end.

Please suggest what else we can do to fix this issue. Thank You.

Re: Invalid Precision Value when using parameters

Posted: Wed 26 Feb 2014 11:55
by AlexP
The problems may be due to different settings of the client and server, please check these settings as well.

Re: Invalid Precision Value when using parameters

Posted: Wed 26 Feb 2014 14:15
by arusoft
Alex, can you please give a little bit more info on setting on Client & Server.

Thank You.

Re: Invalid Precision Value when using parameters

Posted: Fri 28 Feb 2014 11:49
by AlexP
Unfortunately, since we couldn't reproduce the problem on our side, we cannot tell what exact settings can cause the problem

Re: Invalid Precision Value when using parameters

Posted: Mon 03 Mar 2014 02:17
by arusoft
We cannot use SQLServerUniProvider as we already have lot of code written which expects TuniConnection.

But my question is why is uniConnection calling direct connect dialog. Do you know what all reasons would uniConnection called direct connection all by itself.

Thanks.

Re: Invalid Precision Value when using parameters

Posted: Wed 05 Mar 2014 08:48
by AlexP
Please clarify, what you mean by "uniConnection calling direct connect dialog" ?

Re: Invalid Precision Value when using parameters

Posted: Wed 05 Mar 2014 14:40
by arusoft
Its the same login window that appears for Oracle when we set Direct=True as below UniConnection1.SpecificOptions.Add('Oracle.Direct=True');

Thank You.