Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
CursorType
Indicates the type of cursor used in the recordset. The types of cursors
and what they can do are explained later today.
Fields
Contains information about each individual record in the recordset.
Find
(Criteria,
Skip, Dir,
Start)

Searches the recordset for the specified criteria.

LockType (^) Specifies what type of locking to use with this recordset. This will be
covered in more detail later today.
Move() (^) Moves to the specified record.
MoveNext()
Moves to the next record in the record set.
MoveFirst()
Moves to the beginning of the recordset.
MoveLast() (^) Moves to the end of the recordset.
MovePrevious() (^) Moves to the previous record in the recordset.
MaxRecords (^) Indicates the maximum number of records that can be contained in the
recordset. Provides the same function as using the LIMIT keyword in
your SQL statement.
Open(Source,
ActiveConnecti
on,
CursorType,
LockType)
Opens the recordset based on the criteria that is provided.
RecordCount
Indicates how many records are contained in the current recordset.
Sort Tells the recordsset which fields to sort and in what order, descending
or ascending. Same as using the Order By clause in your query.
Source (^) Indicates the source from which the data will come. This can be a
Command object, SQL statement, or a table name.
Format)
Saves the recordset in the destination that is provided in the format that
is indicated. Can be XML.
State
Indicates whether a recordset is open or closed.
Status
Returns a number indicating the status of the current record operation.
Update (^) The counterpart to the AddNew method. After the Update command is
given, all records that were given in the AddNew command will be
added to the database.


Working with the Resultset Object


The best way to use a Recordset object is in conjunction with the Command and Connection objects.
Perform the following steps to open a recordset:



  1. Declare a variable that will contain the Recordset object.
    Dim rstCustomers

  2. Set that variable equal to the results of a Server object’s CreateObject
    method.
    Set rstCustomers = Server.CretaeObject("ADODB.Connection")

  3. Open the Recordset object. There are many ways to open a recordset. They all
    require that you supply a source. This source can be a Command object, SQL
    query, or a table name. The best way is to use a Command object that already has
    a set active connection.
    RstCustomers.Open mCmd,,1,1
    This statement will open a recordset based on the Command object. An active
    connection does not need to be stated in the second argument of this method because
    you are using a Command object that already has an active connection. The next two
    arguments are the type of cursor and the type of locking to use. A number is used

Free download pdf