| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 656 人关注过本帖
标题:关于数据备份问题
取消只看楼主 加入收藏
apple0129
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2008-3-28
收藏
 问题点数:0 回复次数:0 
关于数据备份问题
我想把数据备份,但是总是出现一下错误,不知道是什么原因。请高手指教、代码如下:
private void Linkbutton3_Click(object sender, System.EventArgs e)
        {
            //数据库备份
            string syspath = Server.MapPath("~/data/");
            SQLBACK("127.0.0.1", "sa", "", "peisong", syspath  );

        }

        protected void SQLBACK(string ServerIP, string LoginUserName, string LoginPass, string DBName, string BackPath)
        {
        
            SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
            SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
            try
            {
                oSQLServer.LoginSecure = false;
                oSQLServer.Connect(ServerIP, LoginUserName, LoginPass);
                oBackup.Action = 0;
                oBackup.Database = DBName;
                oBackup.Files = @" " + BackPath + "peisong.bak";
                oBackup.BackupSetName = DBName;
                oBackup.BackupSetDescription = "数据库备份";
                oBackup.Initialize = true;
                oBackup.SQLBackup(oSQLServer);
                Response.Write("<script>alert('数据备份成功!')</script>");
            }
            catch (Exception e)
            {
                throw new Exception(e.ToString());
            }
            finally
            {
                oSQLServer.DisConnect();
            }
        }

“/zyp”应用程序中的服务器错误。
--------------------------------------------------------------------------------

System.Runtime. (0x80040000): [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server 不存在或访问被拒绝 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). at SQLDMO.SQLServerClass.Connect(Object ServerName, Object Login, Object Password) at zyp.left.SQLBACK(String ServerIP, String LoginUserName, String LoginPass, String DBName, String BackPath) in e:\ps\zyp\left.aspx.cs:line 243
搜索更多相关主题的帖子: 数据 
2008-05-22 15:14
快速回复:关于数据备份问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024776 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved