using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
// lambda 。 。 Skip Take
protected void Button1_Click(object sender, EventArgs e)
{
//Func whereLambda = u => { return u.ID == 343; };
EFFristModelEntities db = new EFFristModelEntities();
//var userInfoList = db.UserInfo.Where(u=>u.ID==3); // where lambda 。 。
//
//var userInfoList = db.UserInfo.Where(U => true).OrderBy(u => u.ID); // u.ID ,int u.ID 。 。
//
//var userInfoList = db.UserInfo.Where(U => true).OrderByDescending(u => u.ID); // OrderByDescending 。
//var userInfoList = db.UserInfo.Where(U => true).OrderByDescending(u => u.UserPass).ThenByDescending(u => u.ID);// OrderByDescending,ThenByDescending 。
int pageIndex = 2;
int pageSize = 2;
var userInfoList = (from u in db.UserInfo
where u.ID > 0
orderby u.RegTime ascending, u.ID descending //linq 。
select u).Skip((pageIndex - 1) * pageSize).Take(pageSize); // :Skip: ;Take: 。
foreach (var userInfo in userInfoList)
{
Response.Write(userInfo.UserName + "
");
}
}
}
}