您的位置:首页 > 数据库

Linq to SQL中的模糊查询

2012-12-26 11:43 489 查看
一、

query = from c in tbs
where c.sx != "类别" && c.path_tbname.Contains(tName.Text)
orderby c.id
select c;


二、

IList<string> list = new List<string>();
list.Add("hello the world");
list.Add("hello world");
var result = from t in list
where t.Contains("the")
select t;
foreach (string t in result)
Console.WriteLine(t);
//结果: hello the world


三、

需要引入 System.Data.Linq.SqlClient 命名空间

var query = from c in ctx.Customers
where SqlMethods.Like(c.City, "%ab%")
select c;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: