Oracle错误 - 强制转换无效

时间:2017-03-02 11:59:18

标签: c# oracle linq

我可以通过.NET从Oracle填充数据表但是当我使用LINQ表达式时,我收到此错误..

enter image description here

Linq表达式是:

var hello = dataSet
  .AsEnumerable()                
  .Where(x => ((x.Field<string>("ID") == "DK-076_1") && 
              ((x.Field<string>("AREA") == "FIELD"))))
  .Select(r => r.Field<double>("XSURF"))
  .ToList();

IDVARCHAR2(20)AREAVARCHAR2(20)XSURFNUMBER在Oracle表格中。

1 个答案:

答案 0 :(得分:0)

这是最终的Linq:

 var hello = dataSet.AsEnumerable()                
            .Where(x => ((x.Field<string>("ID") == "DK-076_1") && ((x.Field<string>("AREA") == "DUKHAN_FIELD"))))
             .Select(r => r.Field<decimal>("XSURF")).ToList()
             .Select(item => Convert.ToDouble(item)).ToList();