none
vb6中用SQL-DMO备份数据库出现如下异常 RRS feed

  • 问题

  • Dim oSQLServer  As SQLDMO.SQLServer '   'SQLServer2Class
           
                  Dim oSvr         As SQLDMO.SQLServer
                  Set oSQLServer = CreateObject("SQLDMO.SQLServer")
                  oSQLServer.LoginSecure = False
                  oSQLServer.Connect ("(local)"), ("sa"), ("")            '连接服务器
                  Screen.MousePointer = 11
                  Set bkps = CreateObject("SQLDMO.Backup")
                  bkps.database = "Wingo"        '指定需备份的数据库
                  bkps.Action = 0
                  bkps.Files = "E:\BackUpDataBase\Wingo.BAK"        '指定备份文件
                  bkps.Initialize = True
                  ProgressBar1.Value = 0
                  ProgressBar1.Max = 100
                  Screen.MousePointer = 0
                  DoEvents
                  Err = 0
                  bkps.SQLBackup oSQLServer
                  Screen.MousePointer = 11
                  ProgressBar1.Value = 100
                  DoEvents
                  Set bkps = Nothing
                  Screen.MousePointer = 0
                  MsgBox "数据库备份完成"


    执行完毕后,查看目录,发觉数据库备份已经成功,但是运行到这句bkps.SQLBackup oSQLServer 提示错误
    实时错误 '-2147221499'
    [SQL-DMO]代码执行异常错误:EXCEPTION_ACCESS_VIOLATION

    这是为什么?我该如何处理?

    2009年6月15日 0:46

答案

全部回复