DataAdapter(dataset ,int,int string)帮定不成功,请大家帮忙看一下
显示层代码:
Qshop.BLL.Product pd = new Qshop.BLL.Product();
PagedDataSource ps = new PagedDataSource();
double count = pd.getnum(id);//取得记录总数
ps.AllowPaging = true;
ps.PageSize = 20;
ps.CurrentPageIndex = cutpage - 1;
DataSet ds = pd.getProduct(id, ps.CurrentPageIndex * ps.PageSize, ps.PageSize, "tablelist");
ps.DataSource = ds.Tables["tablelist"].DefaultView;
Repeater1.DataSource = ps;
Repeater1.DataBind();
BLL层:
public DataSet getProduct(int id,int num, int num1, string str)
{
string strsql = "";
Qshop.DAL.DataBase db = new Qshop.DAL.DataBase();
strsql = "select * from product where ppid="+id+" order by padddate,pid desc";
return db.getDataSet(strsql, num, num1,str);
}
DAL层:
public DataSet getDataSet(String sqlstr,int curpage,int countnum,string str)
{
Open();
OleDbCommand cmd = new OleDbCommand(sqlstr, myconn);
OleDbDataAdapter oda = new OleDbDataAdapter();
oda.SelectCommand = cmd;
DataSet ds = new DataSet();
oda.Fill(ds,curpage,countnum,str);
//oda.Fill(ds,str);//用这个是可以的
Close();
return ds;
}