求救!关于sql server备份问题。

wang661 2005-01-19 10:20:13
string _DbName = "eboatqcwx"
string _BuildSQL
string ls_inifile
ls_inifile = GetCurrentDirectory ( ) + '\connect.ini'

SQLCA.DBMS = ProfileString(ls_inifile,"database","DBMS","")
SQLCA.Database = ProfileString(ls_inifile,"database","Database","")
SQLCA.LogPass = ProfileString(ls_inifile,"database","LogPass","")
SQLCA.ServerName = ProfileString(ls_inifile,"database","ServerName","")
SQLCA.LogId = ProfileString(ls_inifile,"database","LogId","")
SQLCA.AutoCommit = False
SQLCA.DBParm = ProfileString(ls_inifile,"database","DBParm","")
connect;
// Profile db_his
_BuildSQL = 'backup database '+_DbName+' to disk = "'+sle_1.text+'";'
运行提示:不能在事务内部执行备份或还原操作。错误代码:3021
...全文
111 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
balloonman2002 2005-01-19
  • 打赏
  • 举报
回复
参考:

http://cpb.cn/download_last.asp?id=48

修改即可
wang661 2005-01-19
  • 打赏
  • 举报
回复
区别就在于:
emp_transobj.DBMS = ProfileString(ls_inifile,"database","DBMS","")
emp_transobj.Database = ProfileString(ls_inifile,"database","Database","")
emp_transobj.LogPass = ProfileString(ls_inifile,"database","LogPass","")
emp_transobj.ServerName = ProfileString(ls_inifile,"database","ServerName","")
emp_transobj.LogId = ProfileString(ls_inifile,"database","LogId","")
emp_transobj.AutoCommit = False
emp_transobj.DBParm = ProfileString(ls_inifile,"database","DBParm","")
嘘嘘兔 2005-01-19
  • 打赏
  • 举报
回复
参考一下:
在窗口上加一个sle
if messagebox('ÌáʾÐÅÏ¢','Êý¾Ý¿â±¸·Ý¿ÉÄÜÐèÒªºÜ³¤Ê±¼ä,»áÔÝʱֹͣÄúµÄǰ̨Èí¼þÔËÐÐ,È·ÈϼÌÐøÂð?',question!,yesno!,2) = 1 then
string _DbName = "db_his"
string _BuildSQL
SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
SQLCA.Database = "db_his"
SQLCA.ServerName = "notebook"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = true
SQLCA.DBParm = ""
connect;
// Profile db_his
_BuildSQL = 'backup database '+_DbName+' to disk = "'+sle_1.text+'";'
st_2.visible = false
st_3.visible = true
EXECUTE IMMEDIATE :_BuildSQL;
if sqlca.sqlcode = 0 then
st_2.visible = true
st_3.visible = false
messagebox('ÌáʾÐÅÏ¢','±¸·ÝÍê±Ï£¡')
close(parent)
else
if SQLCA.Sqlcode=-1 then
f_message()
halt close
end if
end if
end if
disconnect;

wang661 2005-01-19
  • 打赏
  • 举报
回复
现在不提示错了,但是备份文件却没有
progrose 2005-01-19
  • 打赏
  • 举报
回复
备份时, 启动另外一个transaction。
xyqiqi 2005-01-19
  • 打赏
  • 举报
回复
备份的时候,应该断开事务

1,072

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧