access库如何使用ObjectDataSource分页 ??
我学access数据,初学ObjectDataSource分页!!startrowindexparamert和maxmunrowsparamert参数设置如下
public static OleDbDataReader GetUser(int rowIndex, int recordCount)
{
conn = ControlData.Connstring();
string selectString = "select Uid,Name,Password,Rname,RoleId from [User] inner join [Role] on Role.Rid=User.RoleId ";
cmd = new OleDbCommand(selectString, conn);
conn.Open();
DataReader = cmd.ExecuteReader();
return DataReader;
DataReader.Close();
DataReader.Dispose();
}
!!但不知在类方法如何加入上面参数??
试过改为
public static OleDbDataReader GetUser(int rowIndex, int recordCount)
{
//===================================================
//conn = ControlData.Connstring();
//string selectString = "select top @recordCount * from [User] inner join [Role] on Role.Rid=User.RoleId where Uid not in (select top (@rowIndex*recordCount) Uid from [User] order by id desc) order by id desc ";
//OleDbParameter spRowIndex = new OleDbParameter( "@rowIndex ",OleDbType.Integer, 4);
//spRowIndex.Direction = ParameterDirection.Input;
//OleDbParameter spRecordCount = new OleDbParameter( "@recordCount ", OleDbType.Integer, 4);
//spRecordCount.Direction = ParameterDirection.Input;
//spRowIndex.Value = rowIndex;
//spRecordCount.Value = recordCount;
//cmd.Parameters.Add(spRowIndex);
//cmd.Parameters.Add(spRecordCount);
//cmd = new OleDbCommand(selectString, conn);
//conn.Open();
//DataReader = cmd.ExecuteReader();
//return DataReader;
//DataReader.Close();
//DataReader.Dispose();