Ahi va el codigo :
Código Delphi
[-]
adoXls1.First;
while not adoXls1.Eof do
begin
if TryStrToInt(adoXls1.Fields[0].AsString, IntVal) = False then
Continue;
adoXls2.First;
while not adoXls2.Eof do
begin
if adoXls2.Fields[0].AsInteger = IntVal then
begin
cdsCommon1.Insert;
cdsCommon1.Fields[1].AsString := adoXls1.Fields[0].AsString;
cdsCommon1.Fields[0].AsInteger := adoXls2.Fields[0].AsInteger;
cdsCommon1.Post;
Break;
end;
adoXls2.Next;
end;
if adoXls2.Eof then
begin
cdsDiff1.Insert;
cdsDiff1.Fields[1].AsString := adoXls1.Fields[0].AsString;
cdsDiff1.Fields[0].AsInteger := adoXls2.Fields[0].AsInteger;;
cdsDiff1.Post;
end;
Application.ProcessMessages;
adoXls1.Next;
end;
Lo q quiero es entre dos Excel y basado en un campo clave sacar los valores q tiene en comun y los q tiene uno pero el otro no tiene, no se si hay mejor manera