Ask a Question related to ASP, Design and Development.
-
only me #1
Re: how to pass an access DB query onto *next* page? trouble with *next* and *previous* querystring code
Don;t see any sign of any paging code is your snippets
normally take this form
Set rso = Server.CreateObject("ADODB.Recordset")
rso.PageSize = iPageSize '<<<<<<< HOW MANY ITEMS PER PAGE
rso.Open YOURSQL, conn , adOpenStatic, adLockReadOnly
iPageCount = rso.PageCount ' <<<<<<<< TELLS US HOW MANY DB PAGES
THERE ARE
if rso.recordcount > 0 then
rso.AbsolutePage = iPageCurrent '<<<<<<< THIS IS THE CURRENT DB PAGE
YOU WANT TO SHOW
set this
based on your request.querystring("page")
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not rso.EOF
' do stuff here to show each record
rso.movenext
iRecordsShown = iRecordsShown + 1
loop
"cooldv" <mddv@hotmail.com> wrote in message
news:d356c6c0.0308310446.6b6eccc2@posting.google.c om...[url]http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=OVOCG1KKDHA.1[/url]> I am running a querry on an access database and have set the number of
> records/page displayed at 20. if there are more than 20 records
> returned, then 1st page will show the first 20, the next page will
> show next 20 and so on....
>
> here is the trouble:
> the count of total records displayed is correct and the first page is
> displayed correctly. But when i click on *Next* to go to the next
> page, all the records of the database get displayed (not the 2nd page
> of records
> from the query)
>
> obviously there is trouble in the *next* and the *previous*
> querystring code. But what it is and what do i write to correct it?
>
> Someone did suggest a solution at the link below, but i didn't
> understand it.
>
216%40TK2MSFTNGP11.phx.gbl&prev=/groups%3Fdq%3D%26num%3D25%26hl%3Den%26lr%3D
%26ie%3DUTF-8%26group%3Dmicrosoft.public.inetserver.asp.genera l%26start%3D20
0>
> here is the code:
>
> <%
> givenn=request.form("ftn")
> familyn=request.form("ltn")
> newman=request.form("fresher")
> siti=request.form("cty")
> prov=request.form("stt")
> cantree=request.form("ctry")
>
> 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 city"
>
>
> If PageNo > 1 Then
> <a href="query.asp?page=<%= PageNo - 1 %>"><< Prev</a>
> End If
>
> If PageNo < TotalPages Then
> <a href="query.asp?Page=<%= PageNo + 1 %>">Next >></a>
> End If
> %>
>
> any help appreciated
only me Guest
-
Access Code Log In Page
Here's what I'm attempting to do: I need to have a page that has a text box where someone can enter one word or a set numbers. Then when thye... -
Trouble accessing the MS Access 'MSysObjects' system table through an ASP page
Earlier on this board, I got a solution from Ray (thanks again) on how to run a querry to see if a table exists and it works fine in Access. But... -
query a DB - pass the query to next page
I am running a querry on an access database and have set the number of records/page displayed at 20. if there are more than 20 records returned,... -
Pass a querystring through <a href="mailto:xxxx .... using PHP variables
I'm trying to send a link with a querystring as the body of an email message. My HTML syntax looks something like this: <a... -
Code Access to page
There are a couple methods....first you could make use of some application events in global.asax such as Begin Request. However, I would... -
cooldv #2
Re: how to pass an access DB query onto *next* page? trouble with *next* and *previous* querystring code
hi onlyme,
i did not show thw whole code thinking it was probably not related to
the problem. here is the code:
<%
'Requesting the passed URL string ?Page= to identify the image we want
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")
..... code for making DB connection
givenn=request.form("ftn")
familyn=request.form("ltn")
newman=request.form("fresher")
siti=request.form("cty")
prov=request.form("stt")
cantree=request.form("ctry")
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 city"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=20
TotalPages = cInt(rs.pagecount)
rs.absolutepage=PageNo
%>
<%
If PageNo > 1 Then
%>
<a href="query.asp?page=<%= PageNo - 1 %>"><< Prev</a>
<%
End If
%>
<%
response.write "Page " & PageNo & " of " & TotalPages & " "
DO WHILE iMenuCount <= TotalPages
Response.Write "<a href=""query.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="query.asp?Page=<%= PageNo + 1 %>">Next >></a>
<%
End If
%>
if i remove the query and just run the code, then all the pages in the
DB get correctly displayed as 1 2 3 4 5 .... and each page works
correctly.
so it has to be the querystring function
can you help? thanks in advance
cooldv Guest



Reply With Quote

