I'm trying to show 3 records across and 3 records down on my page. Then I want to be able to page to the next set of records and do the same thing. The code I'm using now kind of works.. It lists the id in the columns but will not page through my record set. If I could get some help I would very apreciative.
MY CODE!
_____________________________________________
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("/testsites/crazy/db/cart.mdb" & ";"
objConn.Open
DIM mySQL
mySQL = "SELECT * FROM products"
DIM objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
objrs.CursorLocation = 3 ' adUseClient
objRS.Open mySQL, objConn
objrs.PageSize = 3
intPageCount = objrs.PageCount
Select Case Request("Action"
case "<<"
intpage = 1
case "<"
intpage = Request("intpage"-1
if intpage < 1 then intpage = 1
case ">"
intpage = Request("intpage"+1
if intpage > intPageCount then intpage = IntPageCount
Case ">>"
intpage = intPageCount
case else
intpage = 1
end select
DIM recCount
IF Not objRS.EOF THEN
Response.Write "<table width=100>"
recCount = 0
Do WHILE NOT objRS.EOF
IF recCount Mod 3 = 0 THEN
IF recCount <> 0 THEN Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("id"&"</td>"
ELSE
Response.Write "<td>"&objRS("id"&"</td>"
END IF
recCount = recCount + 1
objRS.MoveNext
Loop
Response.Write"</tr></table>"
ELSE Response.Write "Sorry, there are no records in our database."
END IF
%>
<%
objrs.AbsolutePage = intPage
For intRecord = 1 To objrs.PageSize
%>
<%
objrs.MoveNext
If objrs.EOF Then Exit For
Next
objrs.Close
set objrs = Nothing
%>
<form name="MovePage" action="test.asp" method="post">
<input type="hidden" name="intpage" value="<%=intpage%>">
<input type="submit" name="action" value="<<">
<input type="submit" name="action" value="<">
<input type="submit" name="action" value=">">
<input type="submit" name="action" value=">>">
Page: <%=Intpage & " of " & intpagecount%>
</form>
MY CODE!
_____________________________________________
<%
DIM objConn
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("/testsites/crazy/db/cart.mdb" & ";"
objConn.Open
DIM mySQL
mySQL = "SELECT * FROM products"
DIM objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
objrs.CursorLocation = 3 ' adUseClient
objRS.Open mySQL, objConn
objrs.PageSize = 3
intPageCount = objrs.PageCount
Select Case Request("Action"
case "<<"
intpage = 1
case "<"
intpage = Request("intpage"-1
if intpage < 1 then intpage = 1
case ">"
intpage = Request("intpage"+1
if intpage > intPageCount then intpage = IntPageCount
Case ">>"
intpage = intPageCount
case else
intpage = 1
end select
DIM recCount
IF Not objRS.EOF THEN
Response.Write "<table width=100>"
recCount = 0
Do WHILE NOT objRS.EOF
IF recCount Mod 3 = 0 THEN
IF recCount <> 0 THEN Response.Write "</tr>"
Response.Write "<tr><td>"&objRS("id"&"</td>"
ELSE
Response.Write "<td>"&objRS("id"&"</td>"
END IF
recCount = recCount + 1
objRS.MoveNext
Loop
Response.Write"</tr></table>"
ELSE Response.Write "Sorry, there are no records in our database."
END IF
%>
<%
objrs.AbsolutePage = intPage
For intRecord = 1 To objrs.PageSize
%>
<%
objrs.MoveNext
If objrs.EOF Then Exit For
Next
objrs.Close
set objrs = Nothing
%>
<form name="MovePage" action="test.asp" method="post">
<input type="hidden" name="intpage" value="<%=intpage%>">
<input type="submit" name="action" value="<<">
<input type="submit" name="action" value="<">
<input type="submit" name="action" value=">">
<input type="submit" name="action" value=">>">
Page: <%=Intpage & " of " & intpagecount%>
</form>