Invalid Precision Value when using parameters
Invalid Precision Value when using parameters
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.
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
Hello,
To solve the problem, try to specify explicitly the type and size of the parameter before assigning a value to it.
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
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.
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
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
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.
Thanks.
Re: Invalid Precision Value when using parameters
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
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.
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
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
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.
Please suggest what else we can do to fix this issue. Thank You.
Re: Invalid Precision Value when using parameters
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
Alex, can you please give a little bit more info on setting on Client & Server.
Thank You.
Thank You.
Re: Invalid Precision Value when using parameters
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
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.
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
Please clarify, what you mean by "uniConnection calling direct connect dialog" ?
Re: Invalid Precision Value when using parameters
Its the same login window that appears for Oracle when we set Direct=True as below UniConnection1.SpecificOptions.Add('Oracle.Direct=True');
Thank You.
Thank You.