Using ADO to Communicate with the Database, Part 1 - What is a Recordset?
(Page 2 of 5 )
As name suggests, ‘Recordset’ is nothing but a set of records from a base table or the results of an executed command. At any time, the Recordset object refers to only a single record (row) within the set as the current record. The data which the recordset will provide us, is dependent on the Query/Table/Stored Procedure we provided to open the recordet. When you use ADO, you manipulate data almost entirely using Recordset objects. All Recordset objects consist of records (rows) and fields (columns). Depending on the functionality supported by the provider, some Recordset methods or properties may not be available
Declaring and Opening a Recordset
Dim objRs As ADODB.Recordset
Set objRs = New ADODB.Recordset
Or Dim Objrs As New Adodb.Recordset
objRs.Open "users", objConn, adOpenKeyset, adLockOptimistic, adCmdTable
What Are the Cursor?
A database element that controls record navigation, updateability of data, and the visibility of changes made to the database by other users. There four different types of cursor available in ADO.
- Dynamic cursor — allows you to view additions, changes, and deletions by other users; allows all types of movement through the recordset
- Keyset cursor — behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. Allows all types of navigation through the recordset.
- Static cursor — provides a static copy of a set of records for you to use to find data or generate report. Additions, changes, or deletions by other users will not be visible.
- Forward-only cursor — allows you to only scroll forward through the Recordset. Additions, changes, or deletions by other users will not be visible.
Next: What Are the Lock Types? >>
More Database Code Articles
More By Pradeep Chaudhary