Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting Column Names

Status
Not open for further replies.

tlcable7

Programmer
Aug 18, 2003
7
US
I am filling an HTML Table with values from a select statement. I would like the first row to have the Column Names from the database. How do I select the column names?

Please Help.

Travis Cable
 
Depending on the method of access you will probably find that this is a property of the client side recordset object..

For instance if you were to get the colname from an ado recordset you would could retrieve it to and asp page with the following syntax

rs(0).fieldname
it's value would be
rs(0).value

where 0 is the first field in the fields collection

HTH


Rob
 
It's not working for me...

Here is my ASP code:
------------------------------------------

<tr><% for each x in rs.Fields %>
<td class=&quot;nowrapWhite&quot; bgcolor=&quot;#666666&quot;><% Response.Write(x.fieldname) %></td>
<% next %></tr>
<% do until rs.EOF %>
<tr><% for each x in rs.Fields %>
<td class=&quot;nowrap&quot;><% Response.Write(x.value) %></td>
<% next %></tr>
<% rs.MoveNext %>
<% loop %>

---------------------------------------------------

I am getting this error:

ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.

/surveylane/politics/admin/individual_answers.asp, line 105


What do you think is the problem?

Travis Cable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top