I'm having problems while using Tables in a Paradox Data Base in Delphi.
I need to compare two tables and verify which fields are identical and which are different. At the end, both tables must contain the same values on the fields.
However, everything must be done without using SQL, only pure Delphi.
Here is the code so far, but I'm not getting the expected result:
procedure TForm1.Button3Click(Sender: TObject);
var
s1,s2:string;
begin
Table1.First;
while not (Table1.Eof) do
Begin
s1 := Table1.FieldByName('Campo').AsString;
Table2.First;
while not (Table2.Eof) do
Begin
s2 := Table2.FieldByName('Campo').AsString;
if (s1 <> s2) then
begin
Table2.Append;
Table2.FieldByName('Campo').AsString :=
Table1.FieldByName('Campo').AsString;
end
else if (s1 = s2) then
begin
Table2.Next;
end;
Table2.Next;
End;
Table1.Next;
End;
End;