Udostępnij za pośrednictwem


clsServer

Ostrzeżenie

  Ta funkcja zostanie usunięta z następnej wersji programu Microsoft SQL Server. Nie należy stosować tej funkcji w nowych projektach oraz jak najszybciej należy zmodyfikować aplikacje, w których obecnie jest używana ta funkcja.

An object of ClassType clsServer provides methods and properties that enable you to control an Analysis server.Ten obiekt jest katalog główny drzewa modelu obiektu Decision Support Objects (DSO), która określa baz danych, modułów i ról użytkowników zarządzanych przez serwer.With an object of ClassType clsServer you can:

  • Połączyć się z komputerem, na którym jest uruchomiona usługa serwera analizy (MSSQLServerOLAPService).

  • Uruchamianie i zatrzymywanie serwera.

  • Tworzenie i zarządzanie obiektami, które definiują danych wielowymiarowych struktur.

An object of ClassType clsServer provides collections, methods, and properties through its own internal interface.

Przykłady

A.Tworzenie i Inicjowanie serwera

Do tworzenia i zainicjować serwera, należy użyć następującego kodu.Można użyć LocalHost do określenia Analysis server uruchomionych na tym samym komputerze co aplikacji DSO.

'Create instance of server and connect
Public dsoServer As DSO.Server
Set dsoServer = New DSO.Server
'ServerName is the Windows NT 4.0 Server or Windows 2000 Server computer 
'where the Analysis service is loaded and running.
'An error is raised if the connection attempt fails
dsoServer.Connect "ServerName"

W tym przykładzie programowa ten sam wynik:

DsoServer = New DSO.Server
dsoServer.Name = "ServerName"
dsoServer.Connect

B.Tworzenia i łączenia się z serwerem

The following example shows how to create an instance of a DSO object of ClassType clsServer and connect to an Analysis server:

Public Sub ConnectToServer()
    Dim dsoServer As DSO.Server
    
    On Error GoTo ErrHandler
    
    ' Initialize server.
    Set dsoServer = New DSO.Server
    
    ' Connect to the local Analysis server.
    ' If a connection cannot be made, an error is raised.
    dsoServer.Connect "LocalHost"
    
    ' Print server properties to the Debug window.
    With dsoServer
        Debug.Print "Server Properties --------------------------"
        Debug.Print "Name:            " & .Name
        Debug.Print "Description:     " & .Description
        Debug.Print "ConnectTimeout:  " & .ConnectTimeout
        Debug.Print "LockTimeout:     " & .LockTimeout
        Debug.Print "Version:         " & .Version
    End With
    
    ' Close connection to server.
    dsoServer.CloseServer

ExitRoutine:
    Set dsoServer = Nothing
    Exit Sub
    
ErrHandler:
    Debug.Print "Error connecting to server:"
    Debug.Print Err.Number, Err.Description, Err.Source
End Sub