如何用Delphi控制SQL2000的:导入导出 备份与恢复 用户管理,分配权限等等
最好给个小例子谢谢各位大虾了
[email protected]

解决方案 »

  1.   

    (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;
      

  2.   

    我想直接可以调用SQLSERVER2000的界面可不可以实现呢