码迷,mamicode.com
首页 > 数据库 > 详细

使用ODBC备份Sqlserver数据库失败

时间:2017-12-09 14:11:27      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:return   not   lex   design   ext   执行   handle   backup   first   

软件原来是使用ADO访问LocalDB,现在切换为开源ODBC的C++封装nanodbc,

调试后其他一切正常,可BACKUP DATABASE命令虽然返回成功,但实际备份却没有成功,

查了下资料,在微软网站上发现一个回答

This is by design. Your application must call SQLMoreResults to ensure all the results of the statement are consumed and hence completed. BACKUP sends several messages back to the user to report progress and statistics, and SQLExecDirect returns when the first of these messages is returned. This does not mean the backup has fully completed though. Once SQLMoreResults returns SQL_NO_DATA, you can safely close the statement handle, as you‘ve observed.

执行BACKUP命令后必须再调用SQLMoreResults,在nanodbc不能使用just_execute,需要使用execute且调用result::next_result

使用ODBC备份Sqlserver数据库失败

标签:return   not   lex   design   ext   执行   handle   backup   first   

原文地址:http://www.cnblogs.com/nkzhangkun/p/8011206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!