设置一个Button 
点击Button就调用DTS实现将数据库A中的A1表中所有数据复制到数据库B中的B1表中
其中A1表和B1表是一样的
具体如何实现?

解决方案 »

  1.   

    TBatchMove可以啊
      if Query1.Active = False then
        Exit;
      if SaveDialog1.Execute then
        begin
          Table1.TableName := SaveDialog1.FileName;
          with BatchMove1 do
            begin
              Source := Query1;
              Destination := Table1;
              Mode := batCopy;
              Execute;
              ShowMessage(IntToStr(MovedCount) + ' records copied');
            end;
         end;
      

  2.   

    新建一个bat文件,把需要运行的文件参数写进入,然后用Shellexecute调用
    如:
    1.先在SERVER端建立一个DTS包,如叫DTS_AtoB
    2.编辑a.bat://
    CRUNDTS SERVERNAME sa password DTS_AToB
    3.在button1,onclick事件加入
    Shellexecute(handle,'open','a.bat,'',nil,sw_shownormal);