我正在使用带有 11g Oracle 数据库的 Oracle Client 11.2.0.3,并且在将数字列数据转换为字符串时遇到了麻烦。
var items = new List<string>();
items = (from x in db.Table1
select x.ColA).ToList()); // ColA is NUMBER(9)
如果我使用Convert.ToString(x.ColA)
,我会得到LINQ to Entities does not recognize the method System.String ToString(Int32) method, and this method cannot be translated into a store expression
如果我使用x.ColA.ToString()
,我会得到LINQ to Entities does not recognize the method System.String ToString() method, and this method cannot be translated into a store expression.
如果我使用System.Data.Objects.SqlClient.SqlFunctions.StringConvert((double)x.RESERVATION_ID)
,我会得到The specified method System.String StringConvert(System.Nullable1[System.Double]) on the type System.Data.Objects.SqlClient.SqlFunctions cannot be translated into a LINQ to Entities store expression.