A Recordset object is used for holding records. The records can be all records from a table, or records returned from an SQL SELECT query.
The Open method of the Recordset usually uses the following parameters:
Source The name of the table or SELECT query, or an SQL SELECT statement Active Connection A connection object Cursor Type Basically, how you will view the records, and what you can do with them.
- Can you move backward and forward, or forward only?
- Can you see any changes made by concurrent users?
Cursor Location Is the cursor created on the client machine or the server machine? Lock Type Is the data read-only?
If not, how will you protect your data from concurrent changes by other users?
Options What form is the source in?
- a table name
- a query name
- an SQL statement
Methods for moving through a Recordset:
MoveFirst MoveNext MovePrevious MoveLast Move <count>
Properties of Recordsets:
BOF Beginning of File Is the cursor positioned before the first record? EOF End of File Is the cursor positioned after the last record? Bookmark Marks a particular record so it can be found again easily and set as the current record.
Creating a Recordset:
ASP Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
VB Dim objRS As ADODB.Recordset
Set objRS = New ADODB.Recordset
VB .Net Dim objRS As New ADODB.Recordset