| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1012 人关注过本帖
标题:求助:帮我看看这段数据库还原的代码
取消只看楼主 加入收藏
ruijian1227
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2005-4-22
收藏
 问题点数:0 回复次数:0 
求助:帮我看看这段数据库还原的代码
请问这个组建怎么用?
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
搜索更多相关主题的帖子: 数据库 代码 数据库 代码 
2005-05-08 13:27
快速回复:求助:帮我看看这段数据库还原的代码
数据加载中...
 
   



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

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