Contents | Prev | Next

5.15.21.5 recordset.open

Description

The open method procedure of the recordset object type is used to open a recordset. In order to call this method you need a recordset object reference, a connection object reference to open connection object, as well as the SQL statement which will return the recordset or recordsets, that will be referenced by the open recordset object.

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);

Parameters

  1. This first parameter to this method is a reference to an open connection object.
  2. The second parameter to this method is an expression of type string that evaluates to a SQL statement that will return one or more recorsets.
  3. The third parameter to this method is an expression of type integer that evaluates to the same value as one of the built-in recordset type constants (you should just use one of the recordset type constants directly). If recordset-type is not specified then the default recordset type is assumed.

Portability

Operating Systems: All
Standard Pascal: No

Contents | Prev | Next