Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 July 31st, 2006, 04:07 PM
Authorized User
 
Join Date: May 2006
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default What Do I Change?

Hello,
I am currently getting only 1 row of data showing. What do I need to change in the following so I can have more than 1 row?
Code:
<%
Const NumPerPage = 1

Dim CurPage, myCon, myRS, strSQL
If Request.QueryString("CurPage") = "" then
CurPage = 1
Else
CurPage = Request.QueryString("CurPage")
End If

connection here...

Set myRS = Server.CreateObject("ADODB.Recordset")

myRS.CursorLocation = adUseClient

myRS.CacheSize = NumPerPage

strSQL = "SELECT * FROM tbl_bro"
myRS.Open strSQL, myCon

myRS.MoveFirst
myRS.PageSize = NumPerPage

Dim TotalPages
TotalPages = myRS.PageCount

myRS.AbsolutePage = CurPage

Dim count
%>
Hope to hear...TIA.
(Why is there NOT MUCH activity on the WROX website?)

 
Old July 31st, 2006, 04:40 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

How many rows does your SQL statement return in the database?

Where are the adUseClient, NumPerPage, and CurPage variables set to?

"The one language all programmers understand is profanity."
 
Old August 1st, 2006, 04:01 PM
Authorized User
 
Join Date: May 2006
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's the lot:
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>

<%
Const NumPerPage = 1

Dim CurPage, myCon, myRS, strSQL
If Request.QueryString("CurPage") = "" then
CurPage = 1 'We're on the first page
Else
CurPage = Request.QueryString("CurPage")
End If

Set myCon = Server.CreateObject("ADODB.Connection")
myCon.Open "DBQ=T:\WEBSITE\MiddlePath\access\Mat.mdb; Driver={Microsoft Access Driver (*.mdb)};"

Set myRS = Server.CreateObject("ADODB.Recordset")

myRS.CursorLocation = adUseClient

myRS.CacheSize = NumPerPage

strSQL = "SELECT * FROM tbl_brother"
myRS.Open strSQL, myCon

myRS.MoveFirst
myRS.PageSize = NumPerPage

Dim TotalPages
TotalPages = myRS.PageCount

myRS.AbsolutePage = CurPage

Dim count
%>

<HTML>
<BODY>

<table border="1">
 <tr>
    <th width="20%" scope="col">ORIGIN</th>
    <th width="20%" scope="col">NATIONALITY</th>
  </tr><tr>
<%
Count = 0
Do While Not myRS.EOF And Count < myRS.PageSize
Response.Write "</TD><TD>" & myRS("BrOrigin") & "</TD>" &_
           "<TD>" & myRS("BrNational") & "</TD><TD>" & myRS("BrTown") & "</TD>"
Count = Count + 1
myRS.MoveNext
Loop

Response.Write("Page " & CurPage & " of " & TotalPages & "<P>")
%>
</tr></table>
<%
'Display Next / Prev buttons
if CurPage > 1 then
Response.Write("<INPUT TYPE=BUTTON VALUE=PREV ONCLICK=""document.location.href='try2.asp?curpage=" & curpage - 1 & "';"">")
End If

if CInt(CurPage) <> CInt(TotalPages) then
Response.Write("<INPUT TYPE=BUTTON VALUE=NEXT ONCLICK=""document.location.href='try2.asp?curpage=" & curpage + 1 & "';"">")
End If

%>
</BODY>
</HTML>
This shpw only 1 ROW at a time. I would like it to show at least 5 ROWS. What do I need to change? :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically change value abhisheksud Classic ASP Databases 0 December 13th, 2005 02:33 AM
Change Event Help BryanBrassell Excel VBA 4 July 29th, 2004 03:42 PM
change z-index anshul Javascript How-To 1 July 27th, 2004 03:19 AM
Why does it change kilika VBScript 0 September 18th, 2003 05:14 PM





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