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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, how can i access to the names

Status
Not open for further replies.

mitch77

Programmer
Nov 16, 2000
42
PT
Hi,
how can i access to the names of the fields (columns name), that i have selected in a recordset??

For example, Printing the names of the columns??

Thanks, Mitch
 
Mitch,
You have to do this on an open, non-empty recordset:

<% j = 0
while not j = rs.Fields.Count %>
<td><b><%=rs.Fields.Item(j).Name%><br>
<%'=rs.Fields.Item(j).DataFormat%> |
<%=rs.Fields.Item(j).Type%></b></td>
<% j = j + 1
wend %>

The rs.Fields.Count tels you how many fields you have.
The rs.Fields.Item(j) iterates through your fields. Note this is different than moving through a recordset. You aren't actually changing records.
.Name is the name of the field.
.DataFormat is the data format of the field (in a code)
.Type is the data type of the field (in a code)

Hope this helps.

Harold Blackorby
hblackorby@scoreinteractive.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top