Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Recordset Object.

Similar presentations


Presentation on theme: "The Recordset Object."— Presentation transcript:

1 The Recordset Object

2 Recordset Object (ADO)
When you use ADO, you manipulate data almost entirely using Recordset objects. A Recordset object represents the entire set of records from a database table or the results of an executed command. All Recordset objects are constructed using records (rows) and fields (columns).

3 Recordset Navigation Methods
Navigate through the records in a Recordset with the following Recordset methods MoveFirst MoveLast MoveNext MovePrevious Move Examples: Adodc1.Recordset.Move +5 Adodc1.Recordset.MoveFirst Adodc1.Recordset.MoveLast MoveFirst and MoveLast methods move to the first and last records in the recordset. The MoveNext and MovePrevious methods move relative to the current record or bookmark. The Move method moves a specific number of rows forward or back. The examples show navigation statements to move through a Recordset object which was created by the ADO data control, Adodc1

4 Recordset BOF and EOF Properties
The BOF and EOF properties indicate the beginning or end of the Recordset. The BOF or EOF property is True when you move one record past the first or last record. If both BOF and EOF are True, there are no records in the Recordset. Example: If Adodc1.Recordset.BOF = True Then Adodc1.Recordset.MoveFirst When you open a Recordset, the current record is positioned to the first record (if any) and the BOF and EOF properties are set to False. When you use MoveNext or MovePrevious, you should check the BOF and EOF properties to make sure you do not move off the recordset. The example checks for the beginning of a Recordset object which was created by the ADO data control, Adodc1.

5 Recordset RecordCount Property
Use the RecordCount property to return the number of records in a Recordset object. The property returns -1 when ADO cannot determine the number of records. Reading the RecordCount property on a closed Recordset causes an error. Example: txtRecordCount.Text = Adodc1.Recordset.RecordCount

6 Recordset AbsolutePosition Property
Use the AbsolutePosition property to determine the current record number The AbsolutePosition property is a Long Integer between 1 and the number of records in the Recordset. Example: Use the AbsolutePosition property to move to a record based on its ordinal position in the Recordset object, or to determine the ordinal position of the current record. txtCurrentRecord.Text = Adodc1.Recordset.AbsolutePosition


Download ppt "The Recordset Object."

Similar presentations


Ads by Google