请大家帮我修改一下吧:procedure TForm1.Button1Click(Sender: TObject);
var connstr:string;
begin
  A1.Close ;
  connstr:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+edit1.Text+
                 ';User ID=Admin;Mode=ReadWrite;Persist Security Info=True;'+
                 'Jet OLEDB:Database Password=;Jet OLEDB:Engine Type=1';
  A1.ConnectionString:=connstr;
  A1.Open;
  try
    aq1.Close;
    aq1.SQL.Clear ;
    aq1.SQL.Add('back database    to disk='+''''+edit1.Text+'''');
    //aq1.SQL.Add('insert into 总数据库..总任务书 select * from 核对后数据库..任务书');
    aq1.ExecSQL ;
    edit1.Text :=inttostr(aq1.RecordCount);
  except
    showmessage('失败!');
  end;
总提示错误!
back ……的完整格式是什么?怎样实现将ACCESS库中的数据追加到SQL库里?!

解决方案 »

  1.   

    你不会在后台Sql Server中直接导入和导出吗?????????????
      

  2.   

    (8).备份和恢复
        procedure TForm1.Button1Click(Sender: TObject);
        begin
          if OpenDialog1.Execute then
          begin
            try
              adoconnection1.Connected:=False;
              adoconnection1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=FRIEND-YOFZKSCO;'+
              'Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=FRIEND-YOFZKSCO;Use Encryption for Data=False;Tag with column collation when possible=False';
              adoconnection1.Connected:=True;
              with adoQuery1 do
              begin
                Close;
                SQL.Clear;
                SQL.Add('Backup DataBase sfa to disk ='''+opendialog1.FileName+'''');
                ExecSQL;
              end;
            except
              ShowMessage('±?·Y꧰ü');
            Exit;
            end;
          end;
          Application.MessageBox('1§?2?ú£?êy?Y±?·Y3é1|','ìáê?',MB_OK + MB_ICONINFORMATION);
        end;
        procedure TForm1.Button2Click(Sender: TObject);
        begin
          if OpenDialog1.Execute then
          begin
            try
              adoconnection1.Connected:=false;
              adoconnection1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=FRIEND-YOFZKSCO;'+
              'Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=FRIEND-YOFZKSCO;Use Encryption for Data=False;Tag with column collation when possible=False';
              adoconnection1.Connected:=true;
              with adoQuery1 do
              begin
                Close;
                SQL.Clear;
                SQL.Add('Restore DataBase sfa from disk ='''+opendialog1.FileName+'''');
                ExecSQL;
             end;
           except
             ShowMessage('???′꧰ü');
             Exit;
           end;
         end;
         Application.MessageBox('1§?2?ú£?êy?Y???′3é1|','ìáê?',MB_OK + MB_ICONINFORMATION);
        end;
    http://search.csdn.net/Expert/topic/1879/1879680.xml?temp=.6882288
      

  3.   

    http://www.nssoft.net/showdoc.asp?did=810
      

  4.   

    补充一下,最好带 init 
    backup database 数据库实例名称 to 对应的备份设备 with init
      

  5.   

    带了init,覆盖以前的备份。默认是不带的。恢复的时候语句简单一下,而且备份设置不会很大
      

  6.   

    aq1.Close;
      aq1.SQL.Clear ;
      aq1.SQL.Add('backup database 核对后数据库 to disk=D:\MSSQL7\Data\zsjk.mdf');
      aq1.ExecSQL ;
      运行时提示“缺少insert 、update、”等错误,为何?如何做才可以?!