Reading Data with Fields
The Recordset Object · Created 2026-06-01 13:34:28
Access column values using the Fields collection and individual Field objects.
The Fields Collection
rs.Fields.Count - number of columns
Set f = rs.Fields.Item(0) - first field by index
Set f = rs.Fields.Item('title') - by name (case-insensitive)
Shorthand Access
rs('title') - same as rs.Fields.Item('title').Value
rs(0) - access by zero-based index
Field Object Properties
f.Name - column name
f.Value - current row value
f.Type - ADO data type integer (3=integer, 202=string, etc.)
f.DefinedSize - declared max length
f.ActualSize - actual data length
f.NumericScale - decimal digits (always 0)
f.Precision - numeric precision (always 0)
Iterating Columns
Dim i
For i = 0 To rs.Fields.Count - 1
Response.Write rs.Fields(i).Name & ': ' & rs.Fields(i).Value & '<br>'
Next
Field Values
Always use CInt/CStr/CDbl when assigning to variables
Dim val : val = CInt(rs('id'))
Dim name : name = CStr(rs('title'))
Live Demo →
The Fields Collection
rs.Fields.Count - number of columns
Set f = rs.Fields.Item(0) - first field by index
Set f = rs.Fields.Item('title') - by name (case-insensitive)
Shorthand Access
rs('title') - same as rs.Fields.Item('title').Value
rs(0) - access by zero-based index
Field Object Properties
f.Name - column name
f.Value - current row value
f.Type - ADO data type integer (3=integer, 202=string, etc.)
f.DefinedSize - declared max length
f.ActualSize - actual data length
f.NumericScale - decimal digits (always 0)
f.Precision - numeric precision (always 0)
Iterating Columns
Dim i
For i = 0 To rs.Fields.Count - 1
Response.Write rs.Fields(i).Name & ': ' & rs.Fields(i).Value & '<br>'
Next
Field Values
Always use CInt/CStr/CDbl when assigning to variables
Dim val : val = CInt(rs('id'))
Dim name : name = CStr(rs('title'))
Live Demo →