使用LINQ to Entities中的SqlFunctions调用数据库中的函数

添加引用System.Data.Entity

引用命名空间

using System.Data.Objects.SqlClient;

然后使用SqlFunctions.StringConvert即可

string ids=",1,2,3,4";
var list=db.Where(d=>ids.IndexOf(","+SqlFunctions.StringConvert(d.id)+",")>-1)

 

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
猜你喜欢
  • 2021-12-06
  • 2021-12-25
  • 2021-05-17
  • 2022-12-23
  • 2022-02-08
  • 2022-02-08
  • 2022-03-07
相关资源
相似解决方案