Ken
Mon Sep 15 20:28:45 CDT 2003
Where you are creating the "Next" and "Previous" links. eg:
: <%
: If PageNo > 1 Then
: %>
: <a href="dbQ.asp?page=<%= PageNo - 1 %>"><<
: Prev</a>
: <%
: End If
: %>
You see how you are adding the "&page=<%=PageNo-1%>" data to pass to the
next page? You also need to pass your SQL criteria as well, eg givenN,
familyN etc.
On the next page, you need to get that out of the Request.QueryString
collection (not the Request.Form collection), and recreate your SQL
statement.
To streamline everying, I suggest you change the method of your initial form
from method="post" to method="get". That way you can just access the
Request.QueryString collection no matter which page the user is coming from.
Cheers
Ken
"cooldv" <mddv@hotmail.com> wrote in message
news:d356c6c0.0309151633.3a805c11@posting.google.com...
: Hi Ken,
:
: excuse my dumbo brain! just how do you write the code for what you
: suggested?
: (the demo of my trouble and the code of the file is also shown at:
:
http://www.as.pgims.org/query/query.asp)
:
: here is my code:
: <%
: PageNo = Request.QueryString("Page")
: IF isNumeric(PageNo) THEN
: PageNo = CLng(PageNo)
: END IF
: IF PageNo < 1 THEN PageNo = 1
:
: set conn = server.createobject("adodb.connection")
: DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
: DSNtemp=dsntemp & "DBQ=" & server.mappath("db.mdb")
: conn.Open DSNtemp
:
: dim givenn
: dim familyn
: dim newman
: dim siti
: dim prov
: dim cantree
:
: givenn=request.form("ftn")
: familyn=request.form("ltn")
: newman=request.form("fresher")
: siti=request.form("cty")
: prov=request.form("stt")
: cantree=request.form("ctry")
:
: If givenn = "any" or givenn = "" then
: givenn = ""
: End If
: If familyn = "any" or familyn = "" then
: familyn = ""
: End If
: If newman = "0000" or newman = "" then
: newman = ""
: End If
: If siti = "any" or siti = "" then
: siti = ""
: End If
: If prov = "any" or prov = "" then
: prov=""
: End If
: If cantree = "any" or cantree = "" then
: cantree = ""
: End If
:
: sqlstmt = "SELECT * from database WHERE firstnam like '%"& givenn &"%'
: and lastnam like '%"& familyn &"%' and census like '%"& newman &"' and
: city like '%"& siti &"%' and state like '%"& prov &"%' and country
: like '%"& cantree &"%' ORDER by lastname"
:
: TotalRecs = rs.recordcount
: rs.Pagesize=5
: TotalPages = cInt(rs.pagecount)
: rs.absolutepage=PageNo
:
: <%
: If PageNo > 1 Then
: %>
: <a href="dbQ.asp?page=<%= PageNo - 1 %>"><<
: Prev</a>
: <%
: End If
: %>
:
: <%
: response.write "Page " & PageNo & " of " & TotalPages & " "
: DO WHILE iMenuCount <= TotalPages
: Response.Write "<a href=""dbQ.asp?Page=" & iMenuCount
: IF PageNo = iMenuCount THEN
: Response.Write """ class=""selected"">" & iMenuCount & "</a> "
: ELSE
: Response.Write """ title=""Page " & iMenuCount & """>" & iMenuCount
: & "</a> "
: END IF
: iMenuCount = iMenuCount + 1
: Loop
:
: If PageNo < TotalPages Then
: %>
: <a href="dbQ.asp?Page=<%= PageNo + 1 %>">Next >></a>
: <%
: End If
: %>
:
:
: "Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:<OZJtE7yeDHA.4024@TK2MSFTNGP11.phx.gbl>...
: > If you are using Form posts go to from page to page, then you'll need to
: > create hidden form inputs, eg:
: >
: > <input type="hidden" name="txtState" value="<%=strState%>">
: >
: > and on the next page, check to see if there is a value in
: > Request.Form("txtState"), and if so, you include that in the WHERE
clause of
: > your SQL statement - *the same way that you created the recordset in the
: > first place, for the first page of results*
: >
: > If you are using plain hyperlinks, you can do this via the QueryString.
: >
: > Cheers
: > Ken
: >
: > "cooldv" <mddv@hotmail.com> wrote in message
: > news:d356c6c0.0309141621.2f2f0736@posting.google.com...
: > : hi ken,
: > :
: > : thanks for ur suggestion. can you tell me how do u *pass your
: > : selection criteria from page to page* as you mentioned.