老兄,你这个方法不好,不如改用TADOConnection控件,代码如下:
procedure InsertDifferentDataFromSourceTable
var
cn:TADOConnection;
begin
cn:=TADOConnection.create(nil);
cn.open sConnectString
cn.execute('Insert Into DestTable (BH,Name) Select BH,Name From SrcTable Where BH Not In (Select BH From DestTable)')
end;
一句SQL语句搞定。其中的sConnectionString视你用的数据库不同而不同,如果有问题,可以查查这方面的信息。
procedure InsertDifferentDataFromSourceTable
var
cn:TADOConnection;
begin
cn:=TADOConnection.create(nil);
cn.open sConnectString
cn.execute('Insert Into DestTable (BH,Name) Select BH,Name From SrcTable Where BH Not In (Select BH From DestTable)')
end;
一句SQL语句搞定。其中的sConnectionString视你用的数据库不同而不同,如果有问题,可以查查这方面的信息。
谢谢你!给你加分了!
这两个表分别在不同的服务器上的数据库中阿!