你的程序肯定不能正常运行,因为SQL Server不能恢复正在使用的数据库。Private Sub myRebak()
    Dim cn As New ADODB.Connection
    With cn
        .ConnectionTimeout = 60
        .CursorLocation = adUseServer
        .Mode = adModeShareExclusive
        .Open "Provider=SQLOLEDB; " & _
              "Server=" & ServerName & ";" & _
              "Database=myinvoice;" & _
              "Uid=" & ServerID & ";" & _
              "Pwd=" + ServerPassword + ";"
              
        .Execute "use master"
        
        .Execute "alter database myinvoice set SINGLE_USER"
        .Execute "restore database myinvoice " & _
                 "from disk='" & App.Path & "\" & Combo1.Text & ".dat'"
        .Execute "alter database myinvoice set MULTI_USER"
        
        .Execute "use myinvoice"
    End With
End Sub