求助:帮我看看这段数据库还原的代码
请问这个组建怎么用?Public Sub sDoDB(sType As String, sServerName As String, sDB As String, sUid As String, sPwd As String)
Dim objSQLNS As New SQLNS.SQLNamespace
Dim hItem As Long
Dim objSQLNSObj As SQLNS.SQLNamespaceObject
Dim objSQLNSCom As SQLNS.SQLNamespaceCommand
Dim sTemp As String
On Error Resume Next
err.Clear
Screen.MousePointer = vbHourglass
objSQLNS.Initialize sType & "数据库", SQLNSRootType_Database, "Server=" & sServerName & ";UID=" & sUid & ";PWD=" & sPwd & ";Database=" & sDB & ";", hWnd
Screen.MousePointer = vbDefault
If err.Number <> 0 Then
MsgBox "连接SQL Server 失败", vbCritical, "数据库"
Exit Sub
End If
err.Clear
Screen.MousePointer = vbHourglass
hItem = objSQLNS.GetRootItem
Set objSQLNSObj = objSQLNS.GetSQLNamespaceObject(hItem)
Screen.MousePointer = vbDefault
If err.Number <> 0 Then
MsgBox "生成SQLNS名字空间失败!", vbCritical, "数据库"
Exit Sub
End If
If sType = "备份" Then
Set objSQLNSCom = (10)
objSQLNSCom.Execute hWnd, SQLNamespace_PreferModal
Else
goCn.Execute "use master"
Set objSQLNSCom = (11)
objSQLNSCom.Execute hWnd, SQLNamespace_PreferModal
goCn.Execute "use " & gsDB
End If
goCn.Execute "backup log " & gsDB & " with no_log"
End Sub