| |
jonjacob
Posts: 1
Score: 0
Joined: 7/26/2001
From:
Status: offline
|
when i get my results it shows the data and the page #s at the bottom, this is the first page of results: blah blah blah 1 2 3 4 5 [Next >>] when i click on any of the links it shows all the pages like this: blah blah blah [<< Prev] 1 2 3 4 5 6 7 8 9 10 11 12 [Next >>] and not the next page or the page # that was clicked on. anyone know what is going on? Here is the code This is the form: <form name="search" method="post" action="library/10.asp"> <font color="#000000"> Search for Documents</font> <input type="text" name="srchstrng" size="12"> <input type="submit" name="Submit2" value="Search"> </form> Here is the asp page: <% Dim Input Dim objConn Dim iPageSize Dim iPageCount Dim iPageCurrent Dim strOrderBy Dim strSQL Dim objRS Dim iRecordsShown Dim I Input = Request.Form("srchstrng") Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("ask.mdb") objConn.Open iPageSize = 10 If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If If Request.QueryString("order") = "" Then strOrderBy = "Doc" Else strOrderBy = Request.QueryString("order") End If SQL = "SELECT * FROM DocumentTable " SQL = SQL & "WHERE DocumentTitle Like '%" & input & "%'" Set objRS = Server.CreateObject("ADODB.Recordset") objRS.PageSize = iPageSize objRS.CursorLocation = 3 ' adUseClient objRS.CacheSize = iPageSize objRS.Open SQL, objConn, , , adCmdText iPageCount = objRS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write "<FONT SIZE=""+5"">No records found!" Else objRS.AbsolutePage = iPageCurrent %> <FONT SIZE="2"> Page <B><%= iPageCurrent %></B> of <B><%= iPageCount %></B> </FONT> <% Response.Write "<BR><BR>" & vbCrLf Response.Write "<TABLE WIDTH=""100%"" BORDER=""1"" BORDERCOLOR=""#336699"" CELLSPACING=""0"" CELLPADDING=""4"" BGCOLOR=""#FFFFFF"">" & vbCrLf Response.Write vbTab & "<TR>" & vbCrLf For I = 0 To objRS.Fields.Count - 1 Response.Write vbTab & vbTab & "<TD><B>" Response.Write objRS.Fields(I).Name Response.Write "<B></TD>" & vbCrLf Next 'I Response.Write vbTab & "</TR>" & vbCrLf iRecordsShown = 0 Do While iRecordsShown < iPageSize And Not objRS.EOF Response.Write vbTab & "<TR>" & vbCrLf For I = 0 To objRS.Fields.Count - 1 Response.Write vbTab & vbTab & "<TD>" Response.Write objRS.Fields(I) Response.Write "</TD>" & vbCrLf Next 'I Response.Write vbTab & "</TR>" & vbCrLf iRecordsShown = iRecordsShown + 1 objRS.MoveNext Loop Response.Write "</TABLE>" & vbCrLf End If objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing If iPageCurrent > 1 Then %> <a href="./10.asp?page=<%= iPageCurrent - 1 %>&order=<%= Server.URLEncode(strOrderBy) %>">[<< Prev]</a> <% End If For I = 1 To iPageCount If I = iPageCurrent Then %> <%= I %> <% Else %> <a href="./10.asp?page=<%= I %>&order=<%= Server.URLEncode(strOrderBy) %>"><%= I %></a> <% End If Next 'I If iPageCurrent < iPageCount Then %> <a href="./10.asp?page=<%= iPageCurrent + 1 %>&order=<%= Server.URLEncode(strOrderBy) %>">[Next >>]</a> <% End If %>
|
|