Recordset Navigation
The Recordset Object · Created 2026-06-01 13:34:28
Move through result sets with cursor methods and position properties.
Opening and Closing
Set rs = Server.CreateObject('ADODB.Recordset')
rs.Open 'SELECT * FROM courses', conn
' ... work ... '
rs.Close : Set rs = Nothing
Navigation Methods
rs.MoveNext - forward one row
rs.MovePrevious - backward one row
rs.MoveFirst - jump to first row
rs.MoveLast - jump to last row
rs.Move n - move n rows (positive or negative)
Position Properties
rs.EOF - True past the last row
rs.BOF - True before the first row
rs.RecordCount - total rows (-1 if closed)
rs.AbsolutePosition - 1-based current row position
Iteration Pattern
rs.Open sql, conn
While Not rs.EOF
Response.Write rs('title') & '<br>'
rs.MoveNext
Wend
Paging
rs.PageSize = 5
Dim pages : pages = rs.PageCount
rs.AbsolutePosition = 2 ' 1-based
State
If rs.State = 1 Then rs.Close ' adStateOpen = 1
Live Demo →
Opening and Closing
Set rs = Server.CreateObject('ADODB.Recordset')
rs.Open 'SELECT * FROM courses', conn
' ... work ... '
rs.Close : Set rs = Nothing
Navigation Methods
rs.MoveNext - forward one row
rs.MovePrevious - backward one row
rs.MoveFirst - jump to first row
rs.MoveLast - jump to last row
rs.Move n - move n rows (positive or negative)
Position Properties
rs.EOF - True past the last row
rs.BOF - True before the first row
rs.RecordCount - total rows (-1 if closed)
rs.AbsolutePosition - 1-based current row position
Iteration Pattern
rs.Open sql, conn
While Not rs.EOF
Response.Write rs('title') & '<br>'
rs.MoveNext
Wend
Paging
rs.PageSize = 5
Dim pages : pages = rs.PageCount
rs.AbsolutePosition = 2 ' 1-based
State
If rs.State = 1 Then rs.Close ' adStateOpen = 1
Live Demo →