日期:2014-05-20 浏览次数:21076 次
public static IQueryable GetAllcb_project(int pageIndex, int pageSize, string sort, string dir,out int count) { var query = from q in DataContext.cb_project select new { ProjectID = q.unid, ProjectName = q.prjname, CreatPerson = q.prjauthor, CreatTime = q.createdate }; #region 排序字段和排序方向 if (sort != "" && dir != "") { if (sort == "UNID") { if (dir == "desc") { query = query.OrderByDescending(q => q.ProjectID); } if (dir == "asc") { query = query.OrderBy(q => q.ProjectID); } } } count = query.Count(); #endregion return query.Skip(pageIndex).Take(pageSize); }
SELECT TOP 25 [t0].[unid] AS [ProjectID], [t0].[prjname] AS [ProjectName], [t0].[prjauthor] AS [CreatPerson], [t0].[createdate] AS [CreatTime] FROM [dbo].[cb_project] AS [t0]
SELECT TOP 25 [t0].[unid] AS [ProjectID], [t0].[prjname] AS [ProjectName], [t0].[prjauthor] AS [CreatPerson], [t0].[createdate] AS [CreatTime]
FROM [dbo].[cb_project] AS [t0]
WHERE NOT (EXISTS(
SELECT NULL AS [EMPTY]
FROM (
SELECT TOP 2475 [t1].[unid], [t1].[prjname], [t1].[prjauthor], [t1].[createdate]
FROM [dbo].[cb_project] AS [t1]
) AS [t2]
WHERE ((([t0].[unid] IS NULL) AND ([t2].[unid] IS NULL)) OR (([t0].[unid] IS NOT NULL) AND ([t2].[unid] IS NOT NULL) AND ((([t0].[unid] IS NULL) AND ([t2].[unid] IS NULL)) OR (([t0].[unid] IS NOT NULL) AND ([t2].[unid] IS NOT NULL) AND ([t0].[unid] = [t2].[unid]))))) AND ((([t0].[prjname] IS NULL) AND ([t2].[prjname] IS NULL)) OR (([t0].[prjname] IS NOT NULL) AND ([t2].[prjname] IS NOT NULL) AND ((([t0].[prjname] IS NULL) AND ([t2].[prjname] IS NULL)) OR (([t0].[prjname] IS NOT NULL) AND ([t2].[prjname] IS NOT NULL) AND ([t0].[prjname] = [t2].[prjname]))))) AND ((([t0].[prjauthor] IS NULL) AND ([t2].[prjauthor] IS NULL)) OR (([t0].[prjauthor] IS NOT NULL) AND ([t2].[prjauthor] IS NOT NULL) AND ((([t0].[prjauthor] IS NULL) AND ([t2].[prjauthor] IS NULL)) OR (([t0].[prjauthor] IS NOT NULL) AND ([t2].[prjauthor] IS NOT NULL) AND ([t0].[prjauthor] = [t2].[prjauthor]))))) AND ((([t0].[createdate] IS NULL) AND ([t2].[createdate] IS NULL)) OR (([t0].[createdate] IS NOT NULL) AND ([t2].[createdate] IS NOT NULL) AND ((([t0].[createdate] IS NULL) AND ([t2].[createdate] IS NULL)) OR (([t0].[createdate] IS NOT NULL) AND ([t2].[createdate] IS NOT NULL) AND ([t0].[createdate] = [t2].[createdate])))))
))