procedure TShujuku.SpeedButton2Click(Sender: TObject);
begin
Opendialog1.Title:='选择文件。';
if OPendialog1.Execute then
Edit2.Text:=opendialog1.FileName; If Trim(opendialog1.FileName)<>'' then
begin
try
With Data.ADOQuery3 do
begin
Data.ADOQuery3.Close;
Data.ADOQuery3.SQL.Clear;
Data.ADOQuery3.SQL.Add('use master restore headeronly from disk='''+edit2.text+'''');
Data.ADOQuery3.Open;
end;
Data.ADOQuery3.Last;
Cou:=trim(Data.ADOQuery3.Fields.Fields[5].AsString);
While not Data.ADOQuery3.bof do
begin
Data.ADOQuery3.Prior;
end;
except
Application.MessageBox('错误!','提示',mb_ok);
end;
end; if Edit2.Text = '' then
begin
Showmessage('您已经取消数据库恢复!');
exit;
end;
with Data.ADOConnection2 do
begin
try
ADOCommand1.CommandText:='use master';
ADOCommand1.Execute;
ADOCommand1.CommandText:=' alter database ZLManager set offline with rollback immediate';
ADOCommand1.Execute;
ADOCommand1.CommandText:='restore database ZLManager from disk= '''+edit2.Text+''' with recovery ';
ADOCommand1.Execute;
ADOCommand1.CommandText:=' alter database ZLManager set online with rollback immediate';
ADOCommand1.Execute;
ADOCommand1.Cancel;
MessageBox(handle, '数据库恢复成功!', '提示', mb_IconWarning + mb_Ok);
application.Terminate;
except
on e:exception do
begin
showmessage('数据库恢复失败,请重新恢复!'+e.Message);
end; end;
end;
end;
上面的程序,运行后
提示“数据库恢复成功!”
但再单击其他模块时,
就提示类似的信息:对象名'SutentInfo '无效 ( SutentInfo为学生信息模块中用到的表)
这问题该如何解决? 欢迎回帖,有实用的备份还原程序非常欢迎!
begin
Opendialog1.Title:='选择文件。';
if OPendialog1.Execute then
Edit2.Text:=opendialog1.FileName; If Trim(opendialog1.FileName)<>'' then
begin
try
With Data.ADOQuery3 do
begin
Data.ADOQuery3.Close;
Data.ADOQuery3.SQL.Clear;
Data.ADOQuery3.SQL.Add('use master restore headeronly from disk='''+edit2.text+'''');
Data.ADOQuery3.Open;
end;
Data.ADOQuery3.Last;
Cou:=trim(Data.ADOQuery3.Fields.Fields[5].AsString);
While not Data.ADOQuery3.bof do
begin
Data.ADOQuery3.Prior;
end;
except
Application.MessageBox('错误!','提示',mb_ok);
end;
end; if Edit2.Text = '' then
begin
Showmessage('您已经取消数据库恢复!');
exit;
end;
with Data.ADOConnection2 do
begin
try
ADOCommand1.CommandText:='use master';
ADOCommand1.Execute;
ADOCommand1.CommandText:=' alter database ZLManager set offline with rollback immediate';
ADOCommand1.Execute;
ADOCommand1.CommandText:='restore database ZLManager from disk= '''+edit2.Text+''' with recovery ';
ADOCommand1.Execute;
ADOCommand1.CommandText:=' alter database ZLManager set online with rollback immediate';
ADOCommand1.Execute;
ADOCommand1.Cancel;
MessageBox(handle, '数据库恢复成功!', '提示', mb_IconWarning + mb_Ok);
application.Terminate;
except
on e:exception do
begin
showmessage('数据库恢复失败,请重新恢复!'+e.Message);
end; end;
end;
end;
上面的程序,运行后
提示“数据库恢复成功!”
但再单击其他模块时,
就提示类似的信息:对象名'SutentInfo '无效 ( SutentInfo为学生信息模块中用到的表)
这问题该如何解决? 欢迎回帖,有实用的备份还原程序非常欢迎!
解决方案 »
- DataAbstract如何使用Blob?
- 有关fastreport中分页问题
- 关于findfile()的问题,在线等!
- 拟成立一个软件工作室,现欲吸纳几名成员,详情见内
- 找到delphi的一个bug(delphi7.0)
- 快来快来帮帮忙!
- 请问如何发布三层MIDAS程序在广域网上?急需。。在线等待
- delphi与JSP通过HTTP传输XML来进行数据库的更新和调用
- Help me!Help me!Help me!Help me!Help me!Help me!Help me!Help me!Help me!Help me!
- 欢迎来参观 Nicrosoft 个人摄影作品
- 严重声明,本人和ghyghost (爱国人士) 绝对非马甲关系。本人不会象他那么吝啬,放200分,他才放0分。
- 怎样在程序背景中显示一个网页??
然后在重开.