en general, suponiendo que qc1 está asociado a bd1 y qc2 a bd2, y ambos tienen algo como
Código SQL
[-]select * from Socio order by codigo
, simplemente podría hacerse un recorrido de ambas tablas:
Código Delphi
[-]
Procedure IgualaSocios;
function siguientecodigo(cod : integer) : integer;
begin
qsiguiente.parambyname('codigo').AsInteger := cod;
qsiguiente.open;
try
result := qsiguienteSIGUIENTE.AsInteger;
finally
qsiguiente.close;
end;
end;
begin
qc1.first;
while not qc1.eof do
begin
if not qc2.locate('codigo', qc1codigo.asinteger, []) then
begin
qc2.insert;
qc2codigo.value := qc1codigo.value;
qc2.post;
end
qc1.next;
end;
qc2.first;
while not qc2.eof do
begin
if not qc1.locate('codigo', qc2codigo.AsInteger, []) then
begin
CodigoBorrado := qc2Codigo.AsInteger;
qc2.Delete;
if not qc2.locate('codigo', siguientecodigo(CodigoBorrado), []) then
qc2.Last;
end;
end;
end;
No es muy eficiente, pero si las tablas de socios no son grandes, funcionará aceptablemente bien.
Hasta luego.