开发者

How to fix issue with decimal values in Sybase ODBC driver using NHibernate?

开发者 https://www.devze.com 2022-12-31 08:09 出处:网络
Sybase ODBC driver have an issue with the decimal data type. For example, when an application is trying to save in the database a decimal value occurs this error:

Sybase ODBC driver have an issue with the decimal data type.

For example, when an application is trying to save in the database a decimal value occurs this error:

ERROR [22018] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Implicit conversion from datatype 'VARCHAR' to 'DECIMAL' is not 开发者_如何学JAVAallowed.  Use the CONVERT function to run this query.

Same error occurs when you trying to pass decimal parameter to stored procedure.

How we can fix it using NHibernate or Fluent NHibernate?

Thank you.


I haven't found simple solution for this. I changed in xml's and POCO's System.Decimal to System.Double and it works. I tried add own sql-insert and sql-update in xml files with CONVERT but it didn't work well (eg. value 5.15 was changed to 515).


The Database does not support implicit conversion of char , varchar to decimal . This has the same behaviour for JDBC . Please use Convert function and the run the query .

0

精彩评论

暂无评论...
验证码 换一张
取 消