Skip to main content

RecNo

property RecNo: Integer read write;

Example

procedure MoveToRecord(const Data: TvxClientDataSet; Number: Integer);
begin
Data.RecNo := Number;
end;

Usage

RecNo gets or sets the dataset's current record sequence number, with unsupported base behaviour returning minus one.

  • Use a stable key with Locate when identity matters.
  • Validate the requested range against current dataset semantics; out-of-range writes raise in the client cursor.
  • Writing can auto-Post/Cancel and trigger scroll events.

Additional Technical Info

RecNo is declared by hidden ancestor TDataSet and is normally used through a visible descendant such as TvxClientDataSet. Record numbers are cursor/view metadata, not stable business keys.

Source-backed behaviour

Modified base TDataSet.GetRecNo returns -1 and its setter does nothing. TCustomClientDataSet overrides both: reading requires Active and returns the current buffer's DS cursor record number (or -1 during internal calculation); writing resolves browse mode, invokes before-scroll, moves to the requested sequence, recentres/resynchronizes buffers and invokes after-scroll.

Filtering, indexes, inserts/deletes and refresh/reopen can change numbering. TvxClientDataSet.RecordPosition is a Cardinal proxy over the same property, so unsupported -1 must not be treated as a valid unsigned position.

RecordCount gives descendant count metadata. MoveBy is relative navigation.

Official RTL references

Created 2026-07-15