Guesbook Administration
<% ' Create a Data Connection to the database. Data connection can be any ODBC database as long as a DSN has been created. set oconn = server.CreateObject("ADODB.connection") oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../guestbook.mdb") SQLtemp="SELECT * from guests ORDER BY id ASC" ' Set the paging parameters. MyPageSize is the number of records displayed on each page. we are also checking to see if we should use the SQLtemp string, or the URL encoded SQL string. mypage=request("members") If mypage="" then mypage=1 ' If passing a session variable, include that code here. Example: If you are calling this ASP from an HTML form that has a field called mydescription. 'session("mydescription") = Request.QueryString("mydescription") end if mypagesize=request("pagesize") If mypagesize="" then mypagesize=30 end if mySQL=request("SQLquery") IF mySQL="" THEN mySQL=SQLtemp END IF ' Open a recordset and set paging set ors=Server.CreateObject("ADODB.Recordset") ors.cursorlocation=3 ors.cachesize=20 ors.open mySQL,oconn ors.movefirst ors.pagesize=mypagesize maxpages=cint(ors.pagecount) maxrecs=cint(ors.pagesize) ors.absolutepage=mypage howmanyrecs=0 %>