DataServerManager を使用した Workspace の取得

投稿日:2016/9/1 (木) 更新日:

Private Sub ConnectToSDEExpress()
    Dim pDataServerManager As IDataServerManager
    Set pDataServerManager = New DataServerManager
     
    pDataServerManager.ServerName = "zeke\sqlexpress"   '<サーバ名>\sqlexpress
     
    pDataServerManager.Disconnect   '切断
    pDataServerManager.Connect      '接続
        
    'サーバ情報
    Debug.Print pDataServerManager.DataServerType
    Debug.Print pDataServerManager.ProductName
    Debug.Print pDataServerManager.ProductVersion
    Debug.Print pDataServerManager.DataServerClass
     
     
    Dim pServiceControl As IServiceControl
    Set pServiceControl = pDataServerManager
     
    'サーバステータス
    Debug.Print pServiceControl.HasControlPermissions
    Debug.Print pServiceControl.ServerStatus
     
    pServiceControl.StopServer      '停止
    Debug.Print pServiceControl.ServerStatus
     
    pServiceControl.StartServer     '起動
    Debug.Print pServiceControl.ServerStatus
     
    pServiceControl.PauseServer     '一時停止
    Debug.Print pServiceControl.ServerStatus
     
    pServiceControl.ContinueServer  '再接続
    Debug.Print pServiceControl.ServerStatus
     
    'Workspaceの取得
    Dim pDataServerManagerAdmin As IDataServerManagerAdmin
    Set pDataServerManagerAdmin = pDataServerManager
     
    Dim pWorkspaceName As IWorkspaceName
    Set pWorkspaceName = pDataServerManagerAdmin.CreateWorkspaceName("Landbase", "VERSION", "dbo.Default")  'Workspace情報
     
    Dim pName As IName
    Set pName = pWorkspaceName
     
    Dim pWorkspace As IWorkspace
    Set pWorkspace = pName.Open
 
End Sub

関連記事

-プログラミング, ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.