public List<userinfo> fenye(int pagesize,int nowpage,string table)
{
using (testDataContext db = new testDataContext())
{
string sql = string.Format("select top {0}*{1} * from {2} where id not in (select top ({3}-1)*{4} id from {5})",nowpage,pagesize,table,nowpage,pagesize,table);
return db.ExecuteQuery<userinfo>(sql).ToList();
}
}
public string fenyestr(int pagesize, int nowpage,int count)
{
string str = "";
str += "<a onclick='load(1)'>首页</a><a onclick='load("+(nowpage-1)+")'>上一页</a>";
if (nowpage < 4)
{
str += "<a onclick='loan(1)'>1</a><a onclick='loan(2)'>2</a><a onclick='loan(3)'>3</a><a onclick='loan(4)'>4</a><a onclick='loan(5)'>5</a>";
}
else
{
str += "<a onclick='loan(" + (nowpage - 2) + ")'>" + (nowpage - 2) + "</a><a onclick='loan(" + (nowpage - 1) + ")'>" + (nowpage - 1) + "</a><a onclick='loan(" + nowpage + ")'>" + nowpage + "</a><a onclick='loan(" + (nowpage+1) + ")'>" + (nowpage+1) + "</a><a onclick='loan(" + (nowpage+2) + ")'>" + (nowpage+2) + "</a>";
}
str += "<a onclick='"+(nowpage+1)+"'>下一页</a><a onclick='"+(count/pagesize+1)+"'>尾页</a>";
str += "<input id='page' type='text' /><input type='button' value='跳转' onclick='go()' />";
return str;
}