最好详细些,谢谢!
解决方案 »
- 按位数取字符
- 请问在Delphi当中怎么能把我的数据库连接放在一个地方,在其他地方引用就可以了
- 高分求助:为什么98下TAPI.LineGetID可以取得wave/out的Modem设备号,在2000下就不行了?
- 如何用鼠标拖动选中ListView的多行
- delphi 7怎样调用.net编写的组件
- shgetfileinfo是什么函数,怎么一下多了两个线程
- 初级问题
- 关于“数据库记录太多,如何解决?(500分解决该问题)”问题的给分,请firetoucher(风焱) 、gfh_79_0(ghf) 领分
- Canvas的问题?
- StringGrid自畫圖片顯示問題 解決後一天之內結貼
- 谁能解决这个问题我叫他老大
- 想在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