这个sql怎么转换成linq啊
看下面标红的地方
using (sh_nccDataContext db = new sh_nccDataContext())
{
var query = db.NCC_DeptLogin.Where(n => 1 == 1);
if (!string.IsNullOrEmpty(gridSearchPara))
{
query = query.Where(n => n.Login_DeptName.Contains(gridSearchPara));
Contains方法是类似如sql的 like '%测%',我想实现下面种模糊查询怎么改啊?
like '测%'
}
var count = query.Count();
query = query.Skip((pageIndex - 1) * pageSize).Take(pageSize);
JavaScriptSerializer serializerJs = new JavaScriptSerializer();
var dataJson = serializerJs.Serialize(new { rows = query, total = count });
context.Response.Write(dataJson);
}
------解决方案--------------------n.Login_DeptName.StartsWith(gridSearchPara)
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
------解决方案--------------------同楼上