WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ADO Recordset Object


Examples

GetRows
This example demonstrates how to use the GetRows method.


Recordset Object

The ADO Recordset object is used to hold a set of records from a database table. A Recordset object consist of records and columns (fields).

In ADO, this object is the most important and the one used most often to manipulate data from a database.

ProgID

set objRecordset=Server.CreateObject("ADODB.recordset")

When you first open a Recordset, the current record pointer will point to the first record and the BOF and EOF properties are False. If there are no records, the BOF and EOF property are True.

Recordset objects can support two types of updating: 

  • Immediate updating - all changes are written immediately to the database once you call the Update method.
  • Batch updating - the provider will cache multiple changes and then send them to the database with the UpdateBatch method.

In ADO there are 4 distinctive cursor types defined:

  • Dynamic cursor - Allows you to see increases, changes, and cancellations by other users.
  • Keyset cursor - Like a dynamic cursor, then again, actually you can't see augmentations by different clients, and it averts access to records that different clients have erased. Information changes by different clients will in any case be visible.
  • Static cursor -Provides a static duplicate of a recordset for you to use to discover information or produce reports. Increases, changes, or cancellations by different clients won't be noticeable. This is the main sort of cursor permitted when you open a customer side Recordset object.
  • Forward-just cursor -Allows you to just look forward through the Recordset. Augmentations, changes, or cancellations by different clients won't be visible. 

The cursor type can be set by the CursorType property or by the CursorType parameter in the Open method.

Note: Not all suppliers bolster all strategies or properties of the Recordset object.


Properties

Property Description
AbsolutePage Sets or returns an esteem that determines the page number in the Recordset object
AbsolutePosition Sets or returns an esteem that indicates the ordinal position of the present record in the Recordset object
ActiveCommand Returns the Command object related with the Recordset
ActiveConnection Sets or returns a definition for an association if the association is shut, or on the other hand the present Connection object if the association is open
BOF Returns genuine if the present record position is before the main record, generally false
Bookmark Sets or returns a bookmark. The bookmark spares the situation of the current record
CacheSize Sets or returns the quantity of records that can be cached
CursorLocation Sets or returns the area of the cursor service
CursorType Sets or returns the cursor kind of a Recordset object
DataMember Sets or returns the name of the information part that is destined to be recovered from the item referenced by the DataSource property
DataSource Specifies an item containing information to be spoken to as a Recordset object
EditMode Returns the altering status of the current record
EOF Returns genuine if the present record position is after the last record, generally false
Filter Sets or returns a channel for the information in a Recordset object
Index Sets or returns the name of the present file for a Recordset object
LockType Sets or returns an esteem that determines the kind of locking when altering a record in a Recordset
MarshalOptions Sets or returns an esteem that determines which records are to be come back to the server
MaxRecords Sets or returns the most extreme number of records to come back to a Recordset object from a query
PageCount Returns the quantity of pages with information in a Recordset object
PageSize Sets or returns the most extreme number of records permitted on a single page of a Recordset object
RecordCount Returns the quantity of records in a Recordset object
Sort Sets or returns the field names in the Recordset to sort on
Source Sets a string esteem or a Command object reference, or restores a String esteem that shows the information wellspring of the Recordset object
State Returns an esteem that portrays if the Recordset object is open, shut, associating, executing or recovering data
Status Returns the status of the present record with respect to cluster refreshes or other mass operations
StayInSync Sets or returns whether the reference to the kid records will change when the parent record position changes

Methods

Method Description
AddNew Creates another record
Cancel Cancels an execution
CancelBatch Cancels a clump update
CancelUpdate

Cancels changes made to a record of a Recordset object

Clone Creates a copy of a current Recordset
Close Closes a Recordset
CompareBookmarks Compares two bookmarks
Delete Deletes a record or a gathering of records
Find Searches for a record in a Recordset that fulfills a predefined criteria
GetRows Copies various records from a Recordset object into a two-dimensional array
GetString Returns a Recordset as a string
Move Moves the record pointer in a Recordset object
MoveFirst Moves the record pointer to the first record
MoveLast Moves the record pointer to the last record
MoveNext Moves the record pointer to the following record
MovePrevious Moves the record pointer to the past record
NextRecordset Clears the current Recordset item and returns the following Recordset object by circling through a progression of commands
Open Opens a database component that gives you get to to records in a table, the consequences of an inquiry, or to a spared Recordset
Requery Updates the information in a Recordset by re-executing the question that made the first Recordset
Resync Refreshes the information in the current Recordset from the first database
Save Saves a Recordset item to a document or a Stream object
Seek Searches the file of a Recordset to discover a record that coordinates the predetermined values
Supports Returns a boolean esteem that characterizes whether or not a Recordset object underpins a particular kind of functionality
Update Saves all progressions made to a solitary record  in a Recordset object
UpdateBatch Saves all adjustments in a Recordset to the database. Utilized when working in cluster refresh mode

Events

Note:  You can't deal with occasions utilizing VBScript or JScript (as it were Visual Basic, Visual C++, and Visual J++ dialects can deal with events).

Event Description
EndOfRecordset Triggered when you endeavor to move to a record after the last record
FetchComplete Triggered after all records in an offbeat task have been fetched
FetchProgress Triggered occasionally in an offbeat activity, to state what number of more records that have been fetched
FieldChangeComplete Triggered after the estimation of a Field object change
MoveComplete Triggered after the present position in the Recordset has changed
RecordChangeComplete Triggered after a record has changed
RecordsetChangeComplete Triggered after the Recordset has changed
WillChangeField Triggered before the estimation of a Field object change
WillChangeRecord Triggered before a record change
WillChangeRecordset Triggered before a Recordset change
WillMove Triggered before the present position in the Recordset changes

Collections

Collection Description
Fields Indicates the quantity of Field questions in the Recordset object
Properties Contains all the Property questions in the Recordset object

The Fields Collection's Properties

Property Description
Count Returns the quantity of things in the fields accumulation. Begins at zero.

Example:

countfields=rs.Fields.Count

Item(named_item/number) Returns a predefined thing in the fields gathering.

Example:

itemfields=rs.Fields.Item(1)
or
itemfields=rs.Fields.Item("Name")

The Properties Collection's Properties

Property Description
Count Returns the quantity of things in the properties gathering. Begins at zero.

Example:

countprop=rs.Properties.Count

Item(named_item/number) Returns a predefined thing in the properties gathering.

Example:

itemprop = rs.Properties.Item(1)
or
itemprop=rs.Properties.Item("Name")