如何使用 NHibernate 修复 Sybase ODBC 驱动程序中的十进制值问题?

发布于 2024-09-03 02:05:34 字数 391 浏览 3 评论 0原文

Sybase ODBC 驱动程序存在十进制数据类型问题。

例如,当应用程序尝试在数据库中保存十进制值时,会发生此错误:

ERROR [22018] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Implicit conversion from datatype 'VARCHAR' to 'DECIMAL' is not allowed.  Use the CONVERT function to run this query.

当您尝试将十进制参数传递给存储过程时,也会发生相同的错误。

我们如何使用 NHibernate 或 Fluent NHibernate 修复它?

谢谢。

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 allowed.  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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

残花月 2024-09-10 02:05:34

我还没有找到简单的解决方案。我将 xml 和 POCO 的 System.Decimal 更改为 System.Double 并且它有效。我尝试使用 CONVERT 在 xml 文件中添加自己的 sql-insert 和 sql-update 但效果不佳(例如,值 5.15 更改为 515)。

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).

寻找我们的幸福 2024-09-10 02:05:34

数据库不支持 char 、 varchar 到decimal 的隐式转换。这对于 JDBC 具有相同的行为。请使用转换功能并运行查询。

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 .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文