|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have this script for navigating through a recordset, it all works fine,
except when I click to move to the next page it displays all results again rather than the results only for that page. I've tried every combination of Record cursor types etc. and still no joy. Could someone please help me. Kind Regards Damiano3 <%@ LANGUAGE="VBScript" %> <% Option Explicit %> <!--#INCLUDE FILE="adovbs.inc"--> <% Dim pg, numpages, numrecs, pagesize, rowCount Dim theConnection,prodRS, sqlString,conString pg = TRIM( Request( "pg" ) ) IF pg = "" THEN pg = 1 If pg > numpages Then pg = numpages If pg < 1 Then pg = 1 pagesize = TRIM( Request("recs") ) If pagesize = "" Then pagesize = 9 sqlString = " *********** Query ************** " conString=" ********* Database Connection ********** " Set theConnection = Server.CreateObject("ADODB.Connection") Set prodRS = Server.CreateObject("ADODB.Recordset") prodRS.CursorLocation = 3 prodRS.CursorType = 3 theConnection.Open conString prodRS.Open sqlString,theConnection prodRS.PageSize = pagesize prodRS.AbsolutePage = pg numpages = prodRS.PageCount numrecs = prodRS.RecordCount %> <html> <body> <% Response.Write("" & numrecs & " records found." ) %> <BR> <FORM NAME="myform" METHOD="post" ACTION="results.asp"> Display <SELECT NAME="recs"> <OPTION VALUE=1> 1 <OPTION VALUE=2> 2 <OPTION VALUE=3> 3 <OPTION VALUE=4> 4 <OPTION VALUE=5> 5 <OPTION VALUE=6> 6 <OPTION VALUE=7> 7 <OPTION VALUE=8> 8 <OPTION VALUE=9> 9 <OPTION VALUE=10> 10 </SELECT> images per page <INPUT TYPE=submit VALUE="GO"> </FORM> <BR> <% IF numpages > 1 THEN %> <font color="black" face="Univers">Page: </font> <font color="#811788" face="Univers"> <%=pg %> of <%=numpages %> </font> <BR> <% dim i FOR i = 1 to numpages IF i <> cINT( pg ) THEN %> <a href="results.asp?pg=<%=i%>"> <%=i%></a> <% ELSE %> <b><%=i%></b> <% END IF %> <% NEXT %> <% END IF %> <BR> <% IF pg = 1 THEN %> <% ELSE %> <% j = pg - 1 %> <a href="results.asp?pg=<%=j%>"><img src="leftarrow.jpg" border="0"></a> <% j = pg %> <% END IF %> <% IF (pg) = (numpages) THEN %> <% ELSE %> <% dim j %> <% j = pg + 1 %> <a href="results.asp?pg=<%=j%>"><img src="rightarrow.jpg" border="0"></a> <% j = pg %> <% END IF %> <BR> <% dim m FOR m = 1 to pagesize %> Ref#<%=prodRS( "image_id" )%> <%prodRS.movenext%> <% NEXT %> </body> </html> |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Recordset Problem with Absolutepage and adOpenStatic PLEASE HELP !!!!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|