Hallo zusammen,
nachfolgend ein kleiner Quellcode zum Kopieren von Daten
Delphi-Quellcode:
Function TForm1.DirektCopy(Source,Target:TADOTable):Boolean;
Var
i,j:Integer;
cfname:String;
Begin
//
Result := False;
Try
j := Source.FieldCount-1;
Source.First;
While not Source.Eof do
Begin
Target.Insert;
For i := 0 to j do
Begin
cfname:=Source.Fields[i].FieldName;
if uppercase(cfname) <> 'PINDEX' then
if uppercase(cfname) <> 'ROWGUIIG' then
if Target.FindField(cfname) <> nil then
begin
if (Target.FieldByName(cfname).FieldType <> TGUIField)
and (Target.FieldByName(cfname).FieldType <> TAutoIncField) then
if Source.FieldByName(cfname).AsVariant >'' then
Target.FieldByName(cfname).AsVariant := Source.FieldByName(cfname).AsVariant;
end;
end;
Target.post;
Source.Next;
end;
Result := True;
except
Showmessage('Fehler bei der Umsetzung der Datenbank ');
end;
end;