一拷贝就失败,数据文件已经处于使用中了。

解决方案 »

  1.   

    你COPY的时候先把数据库连接断开不就得了
      

  2.   

    不要用COPY 安全级别不够 用MOVEFILE
      

  3.   

    if BackupDialog.Execute then
        begin
            filePath := BackupDialog.FileName;
        end;
        if length (filePath) < 4 then exit;    if Ado_Backup.Active then Ado_Backup.Close;
        Ado_Backup.SQL.Clear;    Ado_Backup.SQL.Add('RESTORE DATABASE hxxt from disk = ' +
                '''' + filePath + '''');
        try
           if not dm.ADOConnection1.Active then
             dm.ADOConnection1.Active := true; //////////// *******************
           Ado_Backup.ExecSQL;
        except
            MessageDlg('数据恢复不成功!', mtInformation, [mbOK], 0);
            exit;
        end;
        MessageDlg('数据恢复成功!', mtInformation, [mbOK], 0);
      

  4.   

    对就用拷贝文件的方法,或用Copyfile要断开所有的数据库连接