【问题标题】:Invalid cast with dapper and decimal(10,2)dapper 和 decimal(10,2) 的无效转换
【发布时间】:2018-01-17 14:38:47
【问题描述】:

以下代码给了我无效的强制转换操作。 我的 MS Sql 服务器中的 Qty 列的类型为 decimal(10,2)

#region SQL Syntax

var sql = "select qty from productarticle where articleid=@articleid and productid=@productid";

#endregion

using (IDbConnection cn = Connection)
{
    cn.Open();

    return cn.Query<double>(sql, new { articleid = articleid, productid = productid }).Single();
}

如果我尝试将其返回为int,则没有问题。 有什么线索吗?

【问题讨论】:

    标签: c# sql-server-2008 dapper


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-21
      • 2012-11-19
      • 1970-01-01
      • 2020-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多