sql - pager in webpage -
i want create page there prev , next button. when press next button next information in database sample:
id firstname lastname gender position 112 victor bbb male programmer 232 anna xxxx female manager 301 yyyy yyyy male clerk
this data connected other table
sample output htm view
id : 112 fullname: victor bbb gender : male position: programmer department: xxx other information: blahblah ------------------------------------------- <-prev- -next-->
when click next button informtion of anna appear. how can achieve in asp? im new in asp dont how that.
//retrieve requested page page = request.querystring("page") mypagesize=10 const adopenforwardonly = 0 const adlockreadonly = 1 const aduseclient = 3 const adcmdtext = 1 //make sure requested page valid if page = "" page = 1 else page = cint(page) end if displaynum = 0 rs.pagesize = mypagesize rs.cursorlocation = aduseclient sql="select * tablename order id" rs.open sql,objcon ipage = rs.pagecount if page = 0 or page > ipage rs.absolutepage = ipage else rs.absolutepage = page end if while not rs.eof , displaynum < mypagesize //main code display data goes here example resonse.write rs("id")&"<br>" displaynum = displaynum + 1 rs.movenext loop //display navigation if pages more 1 if ipage > 1 if ipage > 1 , page > 1 response.write "<a href='?page="&page-1&"'>"&page-1&"</a> " end if z = 1 ipage if z = page response.write page else response.write "<a href='?page="&z&"'>"&z&"</a> " end if next if ipage > 1 , page < ipage response.write "<a href='?page="&page+1&"'>"&page+1&"</a>" end if end if rs.close
Comments
Post a Comment