日期:2014-05-20  浏览次数:20530 次

初学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();
        }
!!但不知在类方法如何加入上面参数??

------解决方案--------------------
http://www.webdiyer.com/AspNetPager/resources/show.aspx?id=3

可以配合我写的这个免费分页控件来实现,不用写那么多代码了:www.webdiyer.com
------解决方案--------------------
你先要构造出一条用于分页的SQL语句,然后把参数带入
select top @recordCount * from tablename where id not in (select top (@pageindex*@rowindex) id from tablename order by id desc) order by id desc

大概是这样,没有环境,没有测试,说错莫怪!
------解决方案--------------------
select top @recordCount * from tablename where id not in (select top (@rowindex*recordCount) id from tablename order by id desc) order by id desc

上面一句发错了。不好意思!
大概是这样,没有环境,没有测试,说错莫怪!