DelphiFAQ Home Search:
General :: Programming :: Delphi :: Database
Database development with Delphi. Includes issues with BDE, ADO and InterBase.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Copy the current record of a dataset

I found this routine which copies the current record of the currently selected record. This is useful e.g. to keep a temporary record for display in a form.

 // procedure AppendCurrent
 // Written By: Steve Zimmelman
 // 6/4/96
 // Version: Delphi 2.0
 // Will append an exact copy of the current
 // record of the dataset that is passed into
 // the procedure and will return the dataset
 // in edit state with the record pointer on
 // the currently appended record.
 procedure AppendCurrent(Dataset:Tdataset);
   aField : Variant;
   i      : Integer;
   // Create a variant Array
   aField := VarArrayCreate(
   // read values into the array
   for i := 0 to (DataSet.Fieldcount-1) do
      aField[i] := DataSet.fields[i].Value ;
   DataSet.Append ;
   // Put array values into new the record
   for i := 0 to (DataSet.Fieldcount-1) do
      DataSet.fields[i].Value := aField[i] ;

Generated 12:01:32 on Jan 22, 2018