Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 April 27th, 2007, 08:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default x amount of records per column

I have 300 records in my MS SQL 2000 db that I want to pull onto a page which is fine.

However, what I want to do is have 3 columns (for example) with 100 in each - how would I go about doing this?

usually I'd just use:

strSQL = "SELECT * FROM tbl_MyTable"

etc and then loop through the records.

thanks

Adam

 
Old April 27th, 2007, 08:49 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do you mean you want a result set that has 3 columns and 100 rows in each?

I really don't understand your question, are you trying to implement paging?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 27th, 2007, 10:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Yes, well, it might not be 3 columns of 100 rows but I'm using that as an example to show the kind of thing that I need.

Is that paging?

thanks

Adam

 
Old April 27th, 2007, 10:19 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ok. So, what you are saying is that you have 300 rows of data and you will want those records split into x number of columns. (So if it was 5 columns you would want 60 rows of data per each column)

If this is the case you could do it a number of ways. First you could set up paging and display X amount of records based upon y. (num_of_records/num_of_pages = num_of_records_per_page)

You could write some logic like this in your asp page (psuedo code):

Dim sHTML
Dim i
Dim num_cols
Dim num_rows
Dim totalRows

i = 0
totalRows = Select max rows from database (I assume 300 is not a constant value)
num_cols = Request some input (I will use 3)
num_rows = totalRows / num_cols

sHTML = "<tr><td>"
While data object reads
    if i <= num_rows then
       sHTML =sHTML & object[datacolumn] & "<br>"
       i = i + 1
    elseif i > num_rows
       sHTML = sHTML & "</td><td>" & object[datacolumn] & "<br>"
       i = 1
  sHTML += "</td></tr>


<table>
<%=sHTML%>
</table>

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 27th, 2007, 12:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Thanks very much.

This is what I am looking for,





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to retrieve the amount nimmalaramesh SQL Server 2000 1 December 26th, 2007 12:38 PM
Counting amount of record rtr1900 Classic ASP Databases 2 December 1st, 2005 08:08 AM
Finding the highest amount keithd Excel VBA 2 May 25th, 2005 01:44 PM
Redirect after a certain amount of time? budman Classic ASP Basics 2 November 19th, 2003 05:15 PM
Paging records per column malfunction Classic ASP Basics 1 July 29th, 2003 08:38 AM





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