Home All Groups Group Topic Archive Search About

Paging with ASP Classic

Author
3 Jul 2009 12:45 AM
news
Hello all;

  I have ran out of resources and thought that I would try my luck here.
Hopefully someone will have some information for me.

I need to do a paging system.
( I know how to do a basic paging system)
What I need is something like this.

1     5    9
2     6   10
3     7   11
4     8   12
exc.....

Where the records will run down 1 row for a set number
Then run down another row, then a 3rd row.
For a set number of records per page. Like maybe 25 - 30+ records per page.

I have a nice paging system in place now, that I can use, if I can get some
code to do this.

Any ideas on doing something like this?
Thanks all
Carrzkiss

Author
3 Jul 2009 3:35 AM
Adrienne Boswell
Show quote Hide quote
Gazing into my crystal ball I observed "news" <me@nospam.com> writing in
news:3ea6d$4a4d54b9$471e51eb$11421@ALLTEL.NET:

> Hello all;
>
>   I have ran out of resources and thought that I would try my luck
>   here.
> Hopefully someone will have some information for me.
>
> I need to do a paging system.
> ( I know how to do a basic paging system)
> What I need is something like this.
>
> 1     5    9
> 2     6   10
> 3     7   11
> 4     8   12
> exc.....
>
> Where the records will run down 1 row for a set number
> Then run down another row, then a 3rd row.
> For a set number of records per page. Like maybe 25 - 30+ records per
> page.
>
> I have a nice paging system in place now, that I can use, if I can get
> some code to do this.
>
> Any ideas on doing something like this?
> Thanks all
> Carrzkiss
>
>
>

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
<% for i = 1 to 100
response.write  i & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
next
%>
</td>
</tr>
</table>
</body>
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Are all your drivers up to date? click for free checkup

Author
3 Jul 2009 6:31 PM
news
Hello Adrienne
Thanks a bunch for the example. Works great as is.
But how would I go about implementing a RecordSet into it?

Lets say that the RecordSet is:

objRs("MyField")

And have it go through and list all the records in the table for this field?

Thanks

----- Original Message -----
From: "Adrienne Boswell"

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
<%
for i = 1 to 100
response.write  i & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
next
%>
</td>
</tr>
</table>
</body>
</html>
Author
3 Jul 2009 8:03 PM
Evertjan.
news wrote on 03 jul 2009 in microsoft.public.inetserver.asp.general:

> Thanks a bunch for the example. Works great as is.
> But how would I go about implementing a RecordSet into it?
>
> Lets say that the RecordSet is:
>
> objRs("MyField")
>
> And have it go through and list all the records in the table for this
> field?

I hate recordset use, why not simple sql?

You did not specfy the type of db engine.

I read somewhere:

"In MySQL, LIMIT x,y means skip the first x records,
and then return the next y records."

This would hice a nice solutiion:

sql= "SELECT .... LIMIT " & session("pointer") & ",10"

.....

session("pointer") = session("pointer") + 10

===============================

If not available you could mimic this LIMIT by a double select

pseudocode:

SELECT FROM
(SELECT FROM db TOP " & session("pointer") + 10 & " desc)
TOP 10 asc

[nothing tested]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Author
3 Jul 2009 9:06 PM
news
Hello "Evertjan."

Sorry for not mentioning.
(Tested on either) Access Database (or) SQL Server,  But will be used with
SQL Server.

I am not sure that I follow you on the session("Pointer")
Or how to use it with what I am needing.


The code supplied by: Adrienne Boswell
Seems to be what I need, but am having a hard time implemented it with a
database.

There is nothing available online for it.
Everything that you find online is either:

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

(or)

1
2
3
4
5

And I am needing

1     5    9
2     6   10
3     7   11
4     8   12

Thanks a lot guys.
Author
3 Jul 2009 9:56 PM
Adrienne Boswell
Show quote Hide quote
Gazing into my crystal ball I observed "news" <me@nospam.com> writing in
news:618d3$4a4e72ee$471e51eb$26105@ALLTEL.NET:

> Hello "Evertjan."
>
> Sorry for not mentioning.
> (Tested on either) Access Database (or) SQL Server,  But will be used
> with SQL Server.
>
> I am not sure that I follow you on the session("Pointer")
> Or how to use it with what I am needing.
>
>
> The code supplied by: Adrienne Boswell
> Seems to be what I need, but am having a hard time implemented it with
> a database.

Change the i to whatever fields you are getting out of your recordset.

<html>
<head>
<title>Table</title>
</head>
<body>
<table>
<tr>
<td>
<%
'however you are looping through the recordset
for i = 1 to 100
response.write  field.value & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
next
%>
</td>
</tr>
</table>
</body>


Show quoteHide quote
>
> There is nothing available online for it.
> Everything that you find online is either:
>
> 1 2 3 4 5
> 6 7 8 9 10
> 11 12 13 14 15
>
> (or)
>
> 1
> 2
> 3
> 4
> 5
>
> And I am needing
>
> 1     5    9
> 2     6   10
> 3     7   11
> 4     8   12
>
> Thanks a lot guys.
>
>
>
>



--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Author
3 Jul 2009 10:51 PM
news
(((Not sure if the last post went through or not)))

Hello Adrienne
Thanks for your reply.
I had already tried that as well as other things and this is what I get.

<%
While Not objRs.EOF and Count < objRs.PageSize
for i = 1 to 100
st = objRs("MyTitle")
response.write  st & "<br>"
if i mod 20 = 0 then
response.write "</td><td>"
end if
objRS.MoveNext
next
wend
%>

I get
5 Columns
100 Rows

So it is doing as the code originally wants, but ignoring the 20-rows
Here is the actual code with over a 1000+ intries in an Access Database to
test for yourself if you do not mind.
http://www.cffcs.com/Projects/ColumnsRows/Columns.zip

Wayne

Show quoteHide quote
"Adrienne Boswell" <arb***@yahoo.com> wrote in message
>
> <html>
> <head>
> <title>Table</title>
> </head>
> <body>
> <table>
> <tr>
> <td>
> <%
> 'however you are looping through the recordset
> for i = 1 to 100
> response.write  field.value & "<br>"
> if i mod 20 = 0 then
> response.write "</td><td>"
> end if
> next
> %>
> </td>
> </tr>
> </table>
> </body>
>
Author
4 Jul 2009 6:26 PM
Adrienne Boswell
Gazing into my crystal ball I observed "news" <me@nospam.com> writing in
news:80c42$4a4e8b89$471e51eb$1092@ALLTEL.NET:

Please don't top post.  Post correct, see bottom:
Show quoteHide quote
>
> "Adrienne Boswell" <arb***@yahoo.com> wrote in message
>>
>> <html>
>> <head>
>> <title>Table</title>
>> </head>
>> <body>
>> <table>
>> <tr>
>> <td>
>> <%
>> 'however you are looping through the recordset
>> for i = 1 to 100
>> response.write  field.value & "<br>"
>> if i mod 20 = 0 then
>> response.write "</td><td>"
>> end if
>> next
>> %>
>> </td>
>> </tr>
>> </table>
>> </body>
>>
>
>
>
> (((Not sure if the last post went through or not)))
>
> Hello Adrienne
> Thanks for your reply.
> I had already tried that as well as other things and this is what I
> get.
>
><%
> While Not objRs.EOF and Count < objRs.PageSize
> for i = 1 to 100
> st = objRs("MyTitle")
> response.write  st & "<br>"
> if i mod 20 = 0 then
> response.write "</td><td>"
> end if
> objRS.MoveNext
> next
> wend
> %>
>
> I get
> 5 Columns
> 100 Rows
>
> So it is doing as the code originally wants, but ignoring the 20-rows
> Here is the actual code with over a 1000+ intries in an Access
> Database to test for yourself if you do not mind.
> http://www.cffcs.com/Projects/ColumnsRows/Columns.zip
>

Wayne, I'm sorry, but I will not download a zip file. I'm sure you're a
very trustworthy person, but one can never tell.

How many records in pagesize? What 20 rows are you talking about? 
Change the order around:

<%
for i = 1 to 100
   While Not objRs.EOF and Count < objRs.PageSize
     st = objRs("MyTitle")
     response.write  st & "<br>"
     if i mod 20 = 0 then
       response.write "</td><td>"
     end if
     objRS.MoveNext
   wend
next
%>




--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Author
4 Jul 2009 6:48 PM
news
Hello Adrienne
>>Wayne, I'm sorry, but I will not download a zip file.
Not a problem.

>>How many records in pagesize? What 20 rows are you talking about?

OK. Lets look at your code for a minute shall we?

<% for i = 1 to 100 ' How many records that we want to call to the page   #1
response.write  i & "<br>"
if i mod 20 = 0 then ' How many ROWS that we want to display.            #2
response.write "</td><td>"
end if
next
%>

#2 is the 20 Rows that I am referring to.

OK.
Now, to your newest code sample, does not work. Shows 1 complete line only.
If I only have 10 records in the PageSize, it will only show 10 in 1 Column.
If I have 100 in the PageSize, then it will show 100 in a complete single
Column.

So,  This code here is no good.
<%
for i = 1 to 100
   While Not objRs.EOF and Count < objRs.PageSize
     st = objRs("MyTitle")
     response.write  st & "<br>"
     if i mod 20 = 0 then
       response.write "</td><td>"
     end if
     objRS.MoveNext
   wend
next
%>


Have a good 4th of July.

Wayne
Author
4 Jul 2009 6:56 PM
Adrienne Boswell
Show quote Hide quote
Gazing into my crystal ball I observed "news" <me@nospam.com> writing in
news:d6a16$4a4fa408$471e51eb$16905@ALLTEL.NET:

> Hello Adrienne
>>>Wayne, I'm sorry, but I will not download a zip file.
> Not a problem.
>
>>>How many records in pagesize? What 20 rows are you talking about?
>
> OK. Lets look at your code for a minute shall we?
>
><% for i = 1 to 100 ' How many records that we want to call to the page
>  #1
> response.write  i & "<br>"
> if i mod 20 = 0 then ' How many ROWS that we want to display.        
>   #2 response.write "</td><td>"
> end if
> next
> %>
>
> #2 is the 20 Rows that I am referring to.
>
> OK.
> Now, to your newest code sample, does not work. Shows 1 complete line
> only. If I only have 10 records in the PageSize, it will only show 10
> in 1 Column. If I have 100 in the PageSize, then it will show 100 in a
> complete single Column.
>

Wayne, it's untested.  You'll have to play around with it until you get
it right.  Don't do it today, have some food, fireworks and maybe a
libation or two. 

>
> Have a good 4th of July.
>

Thanks, I'm going to.  Hope you have a happy 4th as well. But, don't
over do it on the libations if you want to get started back on your
project tomorrow.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Author
6 Jul 2009 8:29 AM
news
The weekend is over.
And I have almost completed my project, just need a few extra goodies done.
And this is one of them.

Adrienne
Do you think that you could assist me a little more with this issue please
if you have the time?

Hope you had a good 4th of July celebration, mine was spent here on the
system.
trying to get this thing completed.

Wayne

Bookmark and Share