I will look deformed TDataSet.AppendRecord Method: It should be noted Unique Key duplication Oh procedure MyAppendRecord (CD: TDataSet; KeyValues: Variant); var KeyArray: Array of TVarRec; i, aCount: Integer; begin if VarIsArray (KeyValues) then ACOUNT: = VararrayHighBound (KeyValues, 1) 1 Else Acount: = 1; setlength (keyArray, acount); if varisarray (keyvalues) Then Begin for i: = 0 to acount - 1 do begin keyarray [i] .vtype: = Vtvariant; getMem (KeyArray [i] .vvariant, sizeof (variant)); Fillchar (KeyArray [i] .vvariant ^, sizeof (variant), 0); KeyArray [i] .vvariant ^: = variant (keyvalues [i] ); END; Else Begin KeyArray [0] .vtype: = vtvariant; getmem (keyArray [0] .vvariant, sizeof (variant)); Fillchar (KeyArray [0] .vvariant ^, sizeof (variant), 0); KeyArray [0] .vvariant ^: = variant (keyvalues); end; cd.appendrecord (keyArray); if varisaray (keyvalues) Then for i: = 0 to acount - 1 do freemem (KeyArray [i] .vvariant, Sizeof Variant) Else FreeMem (KeyArray [0] .vvariant, Sizeof (Variant)); end; pr Ocedure TForm1.Button1Click (Sender: TOBJECT); VAR i: integer; fields: string; begin fields: = '; for i: = 0 to query1.fieldcount - 1 do fields: = fields query1.fields [i]. FieldName ';'; MyAppendRecord (query1, query1 [fields]);
Chance36
Another solution:
Procedure TFORM1.BITBTN1CLICK (Sender: TOBJECT);
VAR
Variant;
FLDS: String;
SL: TSTRINGS;
Begin
SL: = TSTRINGLIST.CREATE;
DataSet.GetfieldNames (SL);
FLDS: = sl.commatext;
Sl.free;
Flds: = StringReplace (FLDS, ',', ';', [RFREPLACEALL]);
// The following is the same as the above ROVI.
v: = dataset [flds];
DataSet.Append;
DataSet [FLDS]: = V;
/ / Correct different field materials in this
DataSet.post;
END;