Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 08:21 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok try this then

Response.Write "<a href='fiveon.asp&page="&PageCounter&"&strSearchtxt ="&strSearchtxt& "'>" & PageCounter & "</a>"


 
Old August 6th, 2003, 08:27 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Having had another go at the script the HTTP for the second page now looks like this:

http://localhost/socoolbrew/fiveon.a...Terminator%203

When the problem line code is changed to this:

Response.Write "<a href='fiveon.asp&page="&PageCounter&"&strSearchtxt ="&Request("cool") & "'>" & PageCounter & "</a>"

Basically while using a form typed in Terminator 3 which was passed to the script. The input name in the form is: cool Which is request at the top of the script using a FORM.REQUEST and stored in strSearchtxt

If I use strSearch in the above line then in the HTTP strSearchtxt for page 2 equals NULL

So as above tried requested the variable cool directly but it still does work correctly as cool has some invalid values passed to it as stated above.

Does that make sense?



Gaz
 
Old August 6th, 2003, 08:32 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just tried what you have suggested but still get page not found for the next page.

The HTTP line looks like this for page 2:

http://localhost/socoolbrew/fiveon.a...Terminator%203

As the value is Terminator 3

could it be strSearchtxt=Terminator%203

Causing the problem? what does the 2 stand for?

Gaz
 
Old August 6th, 2003, 09:03 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The %20 stands for space in the url, so terminator 3 in the url appears as terminator%203.

ok, the easiest way is, dont write the link using response.write, do somthing like this if you are using a space in the string:

Your code:
For PageCounter = 1 to rsPage.PageCount
Response.Write "<a href='fiveon.asp?Page=" & PageCounter & "'>" & _
PageCounter & "</a> "
Next

Use this:
For PageCounter = 1 to rsPage.PageCount
%>

<a href="fiveon.asp&page=<%=Pagecounter%>&strSearchtx t='
<%=strSearchtxt%>'"><%=Pagecounter%></a>

<%
Next
%>


Let me know if this works.
 
Old August 6th, 2003, 09:31 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Firstly, really appreciate the help.

I have made the modifications as you suggested but still get a NO PAGE FOUND for the second page.

HTTP looks like this:

http://localhost/socoolbrew/fiveon.asp&page=2&strSearchtxt='%20%20%20%20%20%20 TERMINATOR%203'

Any ideas?

This script is turning into a nightmare!

Gaz
 
Old August 6th, 2003, 09:43 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm really at a loss. I cant understand why it wont work :-(

Made a boob before the HTTP for the second page is actually like this:

http://localhost/socoolbrew/fiveon.asp&page=2&strSearchtxt='TERMINATOR%203'

Also, as mentioned before if I dont accept a variable from a form the script works fine. For example if I set strSearchtxt to a value like so

strSearchtxt = "Terminator 3"

within the script works.

Might there be away to accept the input from the form and store it an a variable with the quotes?





Gaz
 
Old August 6th, 2003, 10:13 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmmm, thats interesting why its not working, by default, when you actually assign a value in quotes to a variable, it is a string.
Is it possible for you to email me the code with the db(in a zipped file), it seems that its really becoming a pain for u, i will take a look at it and email u back, my email id is [email protected].(remove the x's).

Chintu

 
Old August 6th, 2003, 10:27 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the offer I shall post the two files and the database to you now. Would really appreciate your help as it's driving me mad.

As a final attempt I tried having the form and scrip all in one page but still no joy :-(

<%@ Language=VBScript %>
<%
   Dim strSearchtxt
   Dim Con
   Dim rsPage
   Dim Page
   Dim RowCount
   Dim PageCounter
   Dim strQuote
   If Request.ServerVariables("QUERY_STRING") <> "" Then
   strSearchtxt = Trim(Request.QueryString("cool"))

   'Get the Current page
   Page = Request.QueryString("Page")

   'If there is no page set it to page 1
   If Page = "" then Page = 1

   RowCount = 0

   set con = server.CreateObject("ADODB.Connection")
   Set rsPage = Server.CreateObject("ADODB.Recordset")

   lsSQL = "SELECT * FROM review WHERE title = '" & strSearchtxt & "'"


   Con.Open "DSN=brewster"

   'Need a rich cursor type to support paging
   rsPage.CursorType = 3 'adOpenStatic

   'Set the number of records in each page to 10
   rsPage.PageSize = 5

   'Open recordset
   rsPage.Open lsSQL, Con

   'Set the current page based on the QueryString value
   'Must cast it as an integer or else it will have problems.
   rsPage.AbsolutePage = cInt(Page)
%>
<html><body>
Writing table:
<%
   If Response.IsClientConnected = true then
      Response.Write "<TABLE>"

      'Loop though each of the records and break out when we
      'have reached the max for this page
      Do while not rsPage.eof and RowCount < rsPage.PageSize

         'Write out content
         Response.Write "<tr><td>" & rsPage("title") & "</td></tr>"

         rsPage.Movenext
         RowCount = RowCount + 1
      Loop

      Response.Write "</TABLE><p>"

      For PageCounter = 1 to rsPage.PageCount
         Response.Write "<a href='fiveon.asp?Page=" & PageCounter & "'>" & _
                         PageCounter & "</a> "

      Next
         rsPage.Close
         set rsPage = Nothing
   End if

%>
</body>
</html>
<%
else
%>
<html>
<body>
Enter a search criteria<br>
<FORM ACTION="<%=Request.ServerVariables("SCRIPT_NAME") %>" METHOD="GET">
First name: <INPUT TYPE="Text" NAME="cool"><BR>
<INPUT TYPE="Submit" NAME="submit" VALUE="Submit Form">
</FORM>
</body>
</html>
<% End If%>



Gaz
 
Old August 6th, 2003, 10:58 AM
Authorized User
 
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

check ur email, i just sent u the updated code, its working on my machine, i assume it should on yours too, let me know if you have any problems..


Chintu

 
Old August 27th, 2006, 01:49 AM
Authorized User
 
Join Date: Aug 2006
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello..can u teach me how to pass the search criteria..i also having problem on this topic....but u all seem stop the diccusion??tq






Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging in jsp with MS Sql Server Jay.Sachin JSP Basics 0 August 17th, 2007 11:21 PM
Paging with Sql Server 2000 walidkayrouz SQL Server 2000 1 August 4th, 2007 07:38 PM
Paging in ASP. rupen Classic ASP Basics 0 October 4th, 2005 08:34 AM
Paging with ASP Luke24 Classic ASP Basics 0 February 9th, 2004 06:13 AM
Paging of Sql Query Result. SubodhKumar SQL Language 4 December 13th, 2003 06:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.