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 29th, 2004, 02:24 PM
Registered User
 
Join Date: Jul 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default displaying multiple fields in columns

I want to display db fields in columns and I am using this code:
dim evalRS
Set evalRS=server.createobject("ADODB.recordset")
sqltext = "SELECT ClassNo, EvaluationNo FROM manager_class_query"
evalRS.Open sqltext, "dsn=ClassEval"
dim RecordArray
dim n
Const cField = 0
If Not evalRS.EOF Then
RecordArray = evalRS.GetRows()
Response.Write("<table>")
For n = 0 to 25
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(cField, n+26))
Response.Write("</td>")
Response.Write("</tr>")
Next
Response.Write("</table>")

END IF

This results in 2 columns of the ClassNo field. I need to display another field EvaluationNo in columns adjacent to ClassNo columns.

Could you help me with this? Thank you

 
Old July 30th, 2004, 08:18 AM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

do you mean access the second column of "RecordArray" for each row in the second column of the table?

Arrays work like: RecordArray(ColumnCount, RowCount)

so
Code:
Response.Write("<table>")
For n = 0 to 25
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(RecordArray(0, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(1, n))
Response.Write("</td>")
Response.Write("</tr>")
Next
Response.Write("</table>")

sorry if Ive got this all mixed up....

Pete

 
Old July 31st, 2004, 08:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi there,

It would always result in ERROR, if your RecordArray hold less than 25 records. So your code should be changed as this.
Code:
Response.Write("<table>")
For n = 0 to UBound(RecordArray,2)
Response.Write("<tr>")
Response.Write("<td>")
Response.Write(RecordArray(0, n))
Response.Write("</td>")
Response.Write("<td>")
Response.Write(RecordArray(1, n))
Response.Write("</td>")
Response.Write("</tr>")
Next
Response.Write("</table>")
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 31st, 2004, 08:37 PM
Authorized User
 
Join Date: Apr 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh yeah, cheers Vijay

:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying data in two columns peterh ASP.NET 2.0 Basics 11 January 29th, 2008 11:08 AM
Displaying Columns in a DataGrid jmss66 VB How-To 0 July 26th, 2007 03:13 PM
Displaying values in multiple columns in Combo abhijeet BOOK: Professional C#, 2nd and 3rd Editions 1 June 15th, 2005 07:01 AM
displaying multiple fields in columns rbegonia XSLT 0 July 29th, 2004 02:21 PM
Updating multiple Rows from multiple fields in ASP vdm_nana SQL Server ASP 0 April 1st, 2004 04:26 AM





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