aysha rouge:关于数据库的备份:请高手看看,看看哪里有问题。这个程序时好时坏。

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 01:55:57
Private Sub mnuBackup_Click()
Dim strsql_DataExport As String
Dim intTime As String, nowTime, nowDate

nowTime = Format(Now, "hh:mm:ss")
intTime = Str(Date)
nowDate = intTime & " " & nowTime

'设置鼠标指针形状 常数:ccHourglass 值:11 描述:沙漏(等待)
Me.MousePointer = 11
'schoolling_basic是需要备份的数据库名称
strsql_DataExport = "backup database schoolling_basic to disk='E:\ Data " & nowDate & " ' with noinit"

Call ExecuteSql(strsql_DataExport)
Err.Number = 0

If Err.Number = 0 Then
MsgBox "数据备份成功!", vbInformation, "提示"
MsgBox "数据备份文件存放路径:" & "E:\Data", vbOKOnly, "提示"
' Unload Me
Else
MsgBox "数据备份失败!请检查数据库是否正在打开!", vbCritical, "提示"
End If

'设置鼠标指针形状 常数:CcArrow 值:1 描述:箭头
Me.MousePointer = 1
End Sub

你是通过使用SQL数据库的存储过程来备份的,正常不应该出错啊,除非执行这些语句时服务管理器没有开启服务。