Logo

OLEDB Direct Components Suite

Rowsets are the central objects that enable OLE DB components to expose and manipulate data in tabular form. A rowset object is a set of rows in which each row has columns of data.

With rowset you can open rowset with OpenTable and OpenQuery methods, move through data using MoveNext, MovePrev, MoveFirst, MoveLast, MoveToBookmark, MoveToRatio methods, get bookmarks using Bookmark property. But to access data you should use accessors.

Rowsets also provides columns information using ColumnInfo property. Item 0 of this list is always a self-bookmark column (if bookmarks are not available, data type will be DBTYPE_EMPTY).

In OLEDB Direct Components Suite rowset are implemented through TOLEDBRowset object.

To open rowset you should:

Example:

uses
    OLEDBComponents;
    
var
   rs: TOLEDBRowset;
   i: Integer;
begin
   rs.DataSource := ds; //Set valid TOLEDBDataSource object here.
   rs.TableName := 'Orders';
   rs.Flags := [rfBookmarks, rfLocate, rfScroll, rfCanScrollBackwards,
        rfCanFetchBackwards, rfCanHoldRows, rfChange, rfDelete, rfInsert,
        rfOwnInsert, rfOwnUpdateDelete];
  rs.Open;
  rs.MoveFirst;
  while not rs.EOF do begin
        //Do anything with rowset here.
    end;
  rs.Close;
end;