主题:sql server数据库恢复,急!
try
ADOCommand1:=TADOCommand.Create(nil);
ADOCommand1.Connection:=FRM_MAIN.FmainADOConnection;
ADOCommand1.CommandText:='ALTER DATABASE RedStar SET OFFLINE WITH ROLLBACK IMMEDIATE';
ADOCommand1.Execute;
ADOCommand1.CommandText:='RESTORE DATABASE RedStar FROM DISK = '''+reportconfig.Restore_Path+'''';
ADOCommand1.Execute;
MessageBox(0,'数据库恢复成功!','仓库管理系统',MB_OK);
finally
ADOCommand1.CommandText:='ALTER DATABASE RedStar SET ONLINE WITH ROLLBACK IMMEDIATE';
ADOCommand1.Execute;
ADOCommand1.Free;
end;
提示错误:用户必须在master数据库中
我这样写恢复语句对吗,如果不对请各位高手指点
ADOCommand1:=TADOCommand.Create(nil);
ADOCommand1.Connection:=FRM_MAIN.FmainADOConnection;
ADOCommand1.CommandText:='ALTER DATABASE RedStar SET OFFLINE WITH ROLLBACK IMMEDIATE';
ADOCommand1.Execute;
ADOCommand1.CommandText:='RESTORE DATABASE RedStar FROM DISK = '''+reportconfig.Restore_Path+'''';
ADOCommand1.Execute;
MessageBox(0,'数据库恢复成功!','仓库管理系统',MB_OK);
finally
ADOCommand1.CommandText:='ALTER DATABASE RedStar SET ONLINE WITH ROLLBACK IMMEDIATE';
ADOCommand1.Execute;
ADOCommand1.Free;
end;
提示错误:用户必须在master数据库中
我这样写恢复语句对吗,如果不对请各位高手指点