问题同上。。想不明白怎么个算法。。大家给个思想
我想知道循环那里怎么写。我还加上分页。。感觉有点乱
OleDbConnection cnn;
OleDbDataAdapter cmd;
DataSet dt = new DataSet();
string strcnn, sql;
strcnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("EDNdata/EDNdatabase.mdb");
cnn = new OleDbConnection(strcnn);
cnn.Open();
sql = "select * from Info where ZClass=4";
cmd = new OleDbDataAdapter(sql, cnn);
cmd.Fill(dt, "Info");
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = dt.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 30;
int CurPage;
if (Request.QueryString["Page"] != null)
{
CurPage = Convert.ToInt32(Request.QueryString["Page"]);
}
else
{
CurPage = 1;
objPds.CurrentPageIndex = CurPage - 1;
lblCurrentPage.Text = "当前:" + CurPage.ToString() + "页";
}
if (!objPds.IsFirstPage)
{
lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
}
if (!objPds.IsLastPage)
{
lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
}
int count = dt.Tables["Info"].Rows.Count;
if (count> 0 && (count + 1) % 10 == 0)
{
DataTable.Rows.Add(" ");
}
repeater3.DataSource = objPds;
repeater3.DataBind();
la3.Text = count.ToString();
cnn.Close();
你们帮我看看。。应该怎么加在里面。。我在里面转不出来