Contents | Prev | Next

5.15.21.1 The recordset type

Description

recordset is the type identifier for a built-in object type whose values identify instances of recordset objects. Instances of recordset objects are used to retrieve groups of records from open database connections.

The recordset object type has four methods:

The recordset object type has two properties:

Example

The code fragment below show a typical use of a recordset. NOTE: The code fragment is not a complete program and makes the following assumptions:

  1. conn is an connection object reference for an open connection object.
  2. conn is connected to a database with a table named customer.
  3. The customer table has the fields last_name and first_name.
   new(rs);
   rs.open(conn, 'select last_name, first_name from customer', rsforward);
   while not rs.eof
      begin
         writeln(rs.field('last_name'), ', ', rs.field('first_name'));
         rs.movenext;
      end;
   rs.close;
   dispose(rs);

First the code fragment creates an instance of a recordset object. Next the recordset object is used to open a forward type recordset. Next the code loops through all the records contained in the recordset printing out the contents of the fields last_name and first_name. Next the recordset is closed. Finally the instance of the recordset object is destroyed.

Portability

Operating Systems: All
Standard Pascal: No

Contents | Prev | Next