private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
// mytable.Style="font: 8pt verdana";
int tempint;
int pn;
if(Request.QueryString["pn"]==null)
{
pn=1;
}
else
{
pn=int.Parse(Request.QueryString["pn"]);
}
int lpp=15;
string strconn=ConfigurationSettings.AppSettings["strconn"];
string selectquery="select titleid,istop,title,postusername,dateandtime,lastpost,lastposttime,hits,subjectname from jforum_bbs order by lastposttime desc";
SqlConnection myconn=new SqlConnection(strconn);
SqlCommand mycomm=new SqlCommand(selectquery,myconn);
mycomm.Connection.Open();
SqlDataReader myreader=mycomm.ExecuteReader();
tempint=(pn-1)*lpp;
while (tempint>0&&myreader.Read())
tempint--;
//get the items of current page
tempint=lpp;
while (tempint>0&&myreader.Read())
{
tempint--;
myrow=new TableRow();
myrow.HorizontalAlign=HorizontalAlign.Center;
myrow.BackColor=Color.FromName("#FFECD8");
mycell=new TableCell();
mycell.Text=myreader["titleid"].ToString();
myrow.Cells.Add(mycell);