end if end function
public function getqueryPage(sql,pageNum,PageSize) on error resume next iRs.pageSize=pageSize iRs.open sql,iconn,1,1 iRs.AbsolutePage=pageNum if irs.eof and irs.bof then getqueryPage=null else set getqueryPage=irs end if response.write ""& err.number & err.description &"" end function ’************************************************************* ’ 让结果集移动到第n页. public function setPage(pageNum,PageSize) on error resume next iRs.moveFirst iRs.move((pageNum-1)*PageSize) end function
end class
’************************************************************* 用法示例: dim cstr dim path path=server.mappath("2data.mdb") cstr= "DBQ="+path+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" dim rec set rec=new RsClass rec.connect(cstr)
response.write "************************" set tt=rec.getqueryPage("select top 8 * from help",2,4) response.write tt.recordcount & " " do while not tt.eof response.write tt(0) &" " tt.movenext loop tt.movefirst tt.close %> |