最好详细些,谢谢!
解决方案 »
- 求解suiPack换肤读ini文件问题
- Delphi操作Excel之 如何关闭所有WorkBooks
- 如何更改Internet选项里面的代理服务器设置
- adoquery添加记录问题!
- 谁能告诉我var()这个函数的参数说明和这个函数的作用?
- DSPACK问题?
- 怎样把StringGrid中的内容输出到文件中,并保持格式。
- Win2000上怎样判断“Oracle服务”已经启动?
- 150分求解:在DELPHI中如何设置鼠标指针的位置?在VB中是用SetCursorPos的。
- 怎么样求某一字段前部分相同的最大值???
- 谁能解决这个问题我叫他老大
- 想在webbrower中链接打开新窗口时,使用自定义的form2,而不是IE,怎么作呢?
1 首先use master等,将你字节的数据库连接放到你要恢复的数据库以外的数据库上
2 用sp_who或者select * from master..sysprocess察看现在正在使用数据库的进程
3 用kill process杀掉连接在你要恢复的数据库上的进程
with adocommand_restore do//用ADocommand控件
begin
CommandText:='use Master';//
Execute;
CommandText:='execute sp_helpdevice';//系统存储过程
Execute ;
CommandText:='Restore database '+db_name+' From disk='''+FileName+''' with replace';
Execute ;
CommandText:='Use '+db_name;
Execute ;
end;
firetoucher(风焱)的正统,但是有时候别人正是要用数据库的时候进程也会被杀的,会有意外
begin
CommandText:='use Master';//
Execute;
CommandText:='execute sp_helpdevice';//系统存储过程
Execute ;
CommandText:='Restore database '+'db_name'+' From disk='''+FileName+''' with replace';//这行应当是这样
Execute ;
CommandText:='Use '+'db_name';//这行应当是这样
Execute ;
application.MessageBox('已经成功备份数据库','数据库备份',MB_OK + MB_ICONINFORMATION);
end;
恢复:
with adocommand1 do//用AdoCommand控件
begin
CommandText:='use Master';
Execute;
CommandText:='execute sp_helpdevice';
Execute ;
CommandText:='Restore database '+'db_name'+' From disk='''+'c:\data1.bak'+''' with replace';//这行应当是这样
Execute ;
CommandText:='Use '+'db_name';//这行应当是这样
Execute ;
application.MessageBox('已经成功恢复数据库','数据库恢复',MB_OK + MB_ICONINFORMATION);
end;
**** 深圳的DELPHI爱好者聚会通知! ****详情请看:
http://www.delphibbs.com/delphibbs/dispq.asp?LID=1619353