Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 20th, 2004, 10:05 AM
john975ca john975ca is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 john975ca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Pagnation - Page redirects fail

I've spent an excessive amount of time developing an Db and an ASP web site. The queries all work (connections are made and record sets opened and close, etc.). Now I've become bogged down with my pagnation attempts! The page includes a script that sets the page size, presents the number of pages and lists the successive page options, etc. With the initial search, this all seems to work. The problem appears when one of the next page selections are made. What I receive is just the page, returned at the beginning (where the selections can be made). This one has frustrated me - so any help is appreciated.

Reply With Quote
  #2  
Old March 22nd, 2004, 11:23 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
If you are on page1, are you telling the next page that you are now on page 2? Ex:

'---get the current page being passed in
nCurPage = Trim ( Request.QueryString ( "curpage" ) )

'---set recorset page size and absolutevalues...
Rs.PageSize = 15 '--15 items per page
Rs.AbsolutePage = nCurPage '--what page are we on

Reply With Quote
  #3  
Old March 23rd, 2004, 10:31 PM
john975ca john975ca is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 john975ca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Still Trying

I've spent so much time on this, I'm going feel real stupid when I finally find the answer! I receive the following error when I try to include your line
Type mismatch:'[string: ""]'

Here's the code:

<%@ Language=VBScript %>

<% Option Explicit %>

<%

' ADO constants used in this page

Const adLockReadOnly = 1

Const adCmdTableDirect = &H0200

Const adUseClient = 3

Dim conn

set conn=Server.CreateObject("ADODB.Connection")

conn.open "FILEDSN=[domain]_[db]_[dsn];UID=;PWD="

Dim rs21

set rs21=CreateObject("ADODB.RecordSet")

rs21.Open "SELECT DISTINCT community FROM comdefinex2 ORDER BY comdefinex2.community",conn

Dim Community

community=request.form("community")

%>

<form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">

<select
name="community" style="font-family: Arial; color: #555555; font-size: "1"" onBlur="java_script_:validateField(this.value, 'Community')">

<option
value="Select a Community">-- Select a Community --</option>

<%

do until rs21.EOF

response.write("<option")

if rs21.fields("community")=community then

response.write(" selected")

end if

response.write(">")

response.write(rs21.fields("community"))

rs21.MoveNext

loop

rs21.close

set rs21=nothing

%>

</select>

<%

Dim rs22

set rs22=CreateObject("ADODB.RecordSet")

rs22.Open "SELECT DISTINCT area FROM pricatbusdefin ORDER BY pricatbusdefin.area",conn

Dim Area

area=request.form("area")

%>

<select name="area" style="font-family: Arial; color: #555555; font-size: "1"" onBlur="java_script_:validateField(this.value, 'Business Category')">

<option
value="Select an Area">-- Select a Business Category --</option>

<%

do until rs22.EOF

response.write("<option")

if rs22.fields("area")=area then

response.write(" selected")

end if

response.write(">")

response.write(rs22.fields("area"))

rs22.MoveNext

loop

rs22.close

set rs22=nothing

%>

</select>

<input
type="submit" value="Check Our Lists">

<input
type="button" name="btnRestart" value="Try Another Selection" onclick="javascript: window.location='<%=Request.ServerVariables("SCRIPT_NAME")%>'">

</form>

<%

Dim rs

Dim record

Dim adOpenStatic

Dim adStateOpen

record=1

if community<>"" then

set rs=CreateObject("ADODB.RecordSet")



rs.ActiveConnection = conn

rs.CacheSize = 15

rs.CursorLocation = adUseClient

rs.CursorType = adOpenStatic

rs.Open "SELECT ..........................FROM ...................WHERE ..................ORDER BY .................", conn, adLockReadOnly



rs.PageSize = 5

Dim abspage, pagecnt

abspage = rs.AbsolutePage

pagecnt = rs.PageCount



Dim nCurPage



if not rs.EOF then



If Len(Request("pagenum")) = 0 Then

rs.AbsolutePage = 1

Else

If CInt(Request("pagenum")) <= rs.PageCount Then

rs.AbsolutePage = Request("pagenum")

Else

rs.AbsolutePage = 1

End If

End If

%>

<tr><td><font ...........><b>We have found <%=rs.RecordCount%> listings that match your request.</font></td></tr>

<%

Do While Not rs.EOF AND Record <= rs.pagesize



response.write rs("listingname")



If Len(rs("mphone")) > 0 then

Dim re2

Set re2 = New RegExp

re2.Pattern = "(\d{3})(\d{3})(\d{4})"

Response.Write re2.Replace(rs("mphone"), "($1) $2 - $3")

Set re2 = Nothing

End If

response.write("<br />")



Dim suite

Dim civic

Dim street

Dim province

Dim pcode

Dim mcstatdefin

Dim restatdefin

Dim profilepg

suite=rs("suite")

if suite<>"" then

response.write rs("suite")

response.write(" - ")

end if



civic=rs("civic")

if civic<>"" then

response.write rs("civic")

response.write(", ")

end if



response.write rs("street")

response.write(", ")

response.write rs("community")

response.write(", ")

response.write rs("province")

response.write(" ")

pcode=rs("pcode")

if pcode<>"" then

response.write rs("pcode")

end if

response.write("<br />")

response.write"Member Choice Status is"

response.write rs("mcstatdefin")

response.write("<br />")

response.write"Recommended Status is"

response.write rs("restatdefin")

response.write("<br />")



profilepg=rs("profilepg")

if profilepg<>"b111111.asp" then



<a href="<%response.write rs("profilepg")%>
" style="text-decoration: blink"><font size="2" face="arial" color="ffffff"><b>Visit Our Profile</b>



<%

end if

Record = Record + 1

rs.movenext

loop



' Now showing first, next, back, last buttons.



' abspage = Trim ( Request.QueryString ( "pagenum" ) )



Response.Write "<div align=""center"">" & vbcrlf

Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=1"">First Page</a>"

Response.Write "&nbsp;|&nbsp;"



If abspage = 1 Then Error referrs to this line!

Response.Write "<span style=""color:silver;"">Previous Page</span>"

Else

Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage - 1 & """>Previous Page</a>"

End If



Response.Write "&nbsp;|&nbsp;"



If abspage < pagecnt Then

Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage + 1 & """>Next Page</a>"

Else

Response.Write "<span style=""color:silver;"">Next Page</span>"

End If

Response.Write "&nbsp;|&nbsp;"

Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & pagecnt & """>Last Page</a>"

Response.Write "</div>" & vbcrlf

else

response.write("Sorry, we have found no matches. ")

response.write("<br />")

response.write("Please redefine your search criteria and try once again.")



end if

end if

'Object cleanup

If IsObject(rs) Then

If Not rs Is Nothing Then

If rs.State = adStateOpen Then rs.Close

Set rs = Nothing

End If

End If

If IsObject(conn) Then

If Not conn Is Nothing Then

If conn.State = adStateOpen Then conn.Close

Set conn = Nothing

End If

End If

%>


Reply With Quote
  #4  
Old March 24th, 2004, 12:16 AM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
Try:

If abspage = "1" Then

Send me a private message with your email and I will email you a page I made with paging.

Reply With Quote
  #5  
Old March 26th, 2004, 03:56 PM
john975ca john975ca is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 john975ca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

Thanks for all the assistance. I have it working great now. ASP Free Forums "ROCKS"!

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Pagnation - Page redirects fail


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT