Linq to SQL 中将数字转换为字符串

 使用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)
原文地址:https://www.cnblogs.com/war-hzl/p/6775164.html