linq to SQL link 和in 操作
2012-06-08 14:32
411 查看
直接上代码:一看就懂
var query = from c in ctx.Customers
where c.City == "London"
select c;,
var query = from c in ctx.Customers
where c.City.StartsWith("Lo")
select c;
var query = from c in ctx.Customers
where c.City.StartsWith("L") && c.City.Contains("n")
select c;
var query = from c in ctx.Customers
where SqlMethods.Like(c.City, "L_n%")
select c;
相当于SQL语句中的 where 字段名 in()
var ids ={1,2,3};
var query =from item in context.items
where ids.Contains( item.id )
select item;
var result = from col in dt.AsEnumerable() where (new string[] { "Save", "Revocation", "Auditing", "EndAudit" }).Contains(col[name]) select col[name];
var query = from c in ctx.Customers
where c.City == "London"
select c;,
var query = from c in ctx.Customers
where c.City.StartsWith("Lo")
select c;
var query = from c in ctx.Customers
where c.City.StartsWith("L") && c.City.Contains("n")
select c;
var query = from c in ctx.Customers
where SqlMethods.Like(c.City, "L_n%")
select c;
相当于SQL语句中的 where 字段名 in()
var ids ={1,2,3};
var query =from item in context.items
where ids.Contains( item.id )
select item;
var result = from col in dt.AsEnumerable() where (new string[] { "Save", "Revocation", "Auditing", "EndAudit" }).Contains(col[name]) select col[name];
相关文章推荐
- Linq to SQL 语法查询(链接查询,子查询 & in操作 & join,分组统计等)
- Linq to SQL 语法查询(子查询 & in操作 & join )
- Linq to SQL 语法查询(子查询 & in操作 & join )(转载)
- Linq to sql :查询句法--in 操作
- linq to sql 中的in 操作实现
- Linq to SQL 语法查询(子查询 & in操作 & join )
- Linq to SQL 语法查询....子查询 & in操作 & join
- Linq to SQL 语法查询(子查询 & in操作 & join )
- LINQ to SQL查询操作(3)语句之Join和Order By
- Linq to SQL 的增删改查操作
- Linq To Sql数据库操作基类实现不同条件的增删改查
- Linq to SQL how to do “where [column] in (list of values)”
- N 层应用程序中的数据检索和 CUD 操作 (LINQ to SQL)
- Silverlight 2 (beta1)数据操作(6)——使用LINQ to SQL进行数据CRUD操作(下)
- Linq To Sql CRUD操作示例
- LINQ to SQL语句之Group By/Having和Exists/In/Any/All/Contains
- .关于操作数据库的接口(Linq to SQL )——转自csdn
- [导入]Silverlight 2 (beta1)数据操作(5)——使用LINQ to SQL进行数据CRUD操作(上)
- LINQ to SQL语句(7)之Exists/In/Any/All/Contains
- LINQ to SQL语句(7)之Exists/In/Any/All/Contains