我用PB做sqlserver 2012的数据还原和备份的操作,备份没问题,但是在还原的时候报错提示,我的代码是网上找的,//===============================================================
string ls_iniFile = "dsn.ini", ls_sql,ls_lj
integer li_flag
ls_lj = "D:\llfdhbback\sfqdmm_20140622163307.bak"
if trim (ls_lj) = '' or isNull (ls_lj) then
messagebox ("提示", "请选择一个备份文件!")
return
end if
if not FileExists ( trim (ls_lj) ) then
messagebox ("提示", "指定的文件不存在!")
return
end if
ls_sql = "USE Master restore database sfqdmm from disk = '"+ trim (ls_lj) + "' with replace"
Transaction SQLCA_Master
SQLCA_Master = CREATE transaction
SQLCA_Master.DBMS = "SNC SQL Native Client(OLE DB)"
SQLCA_Master.Database ="master"
SQLCA_Master.LogID = 'sa'
SQLCA_Master.LogPass = "1q!qaaaa"
SQLCA_Master.ServerName= "127.0.0.1"
SQLCA_Master.DBparm = "Secure=1"
SQLCA_Master.AutoCommit= true
setpointer (hourGlass!)
disconnect using sqlca;
connect using sqlca_master;
if sqlca_master.SQLCode <> 0 then
messageBox ("错误", "连接数据库错误!~r~n~r~n错误代码:" + &
string (sqlca_master.sqlDbCode) + "~r~n详细信息:" + &
sqlca_master.sqlERRText, stopSign!)
end if
EXECUTE IMMEDIATE :ls_sql USING SQLCA_Master;
if SQLCA_Master.SQLCode <> 0 then
messageBox ("数据库错误", "还原数据库错误!~r~n~r~n错误代码:" + &
string (SQLCA_Master.sqlDbCode) + "~r~n详细信息:" + &
SQLCA_Master.sqlERRText, stopSign!)
else
li_flag = 1
messageBox ("提示", "还原数据库成功!")
end if
disconnect using sqlca_master;
connect using sqlca;
destroy sqlca_master
高手帮我看看呀
------解决方案--------------------
把use master去掉看看