Examples, clsServer

The following example shows how to create an instance of a Decision Support Objects (DSO) clsServer object and connect to an OLAP server.

Option Explicit

'Declarations

Public dsoServer As DSO.Server

Public intClassType As Integer

Public strClassType As String

Public strErr As String

Public blnRet As Boolean

Private Sub Form_Load()

On Error GoTo FormLoad_Err

'Initialize server

Set dsoServer = New DSO.Server

'ServerName is the OLAP server name

'If unable to connect, error will occur here

dsoServer.Connect("ServerName")

intClassType = dsoServer.ClassType

Select Case intClassType

    Case clsServer

        strClassType = "Server"

        dsoServer.Description = "OLAP server"

    Case Else

        strClassType = "Invalid Class Type"

End Select

Debug.Print "SERVER PROPERTIES:"

Debug.Print "Name:          " & dsoServer.Name

Debug.Print "ClassType:     " & strClassType

Debug.Print "Description:   " & dsoServer.Description

    

Exit Sub

FormLoad_Err:

    Debug.Print "Error connecting to server"

    Debug.Print Err.Number, Err.Description, Err.Source

    Debug.Assert False

    Err.Clear

End Sub

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.