既存のクエリ レイヤーから情報を取得

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

Sub GetQueryLayerInfo()
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
         
    Dim pFL As IFeatureLayer
    Set pFL = pMxDoc.FocusMap.Layer(0)
     
    Dim pDataset As IDataset
    Set pDataset = pFL
     
    Dim pQueryTableName As IQueryTableName
    Set pQueryTableName = pDataset.FullName
     
    Dim pQueryDescription As IQueryDescription
    Set pQueryDescription = pQueryTableName.QueryDescription
     
    Debug.Print pQueryTableName.Query   'クエリの変更
     
    Dim pDatasetName As IDatasetName
    Set pDatasetName = pQueryTableName
     
    Dim pWorkspaceName As IWorkspaceName
    Set pWorkspaceName = pDatasetName.WorkspaceName
     
    Dim pPropertySet As IPropertySet
    Set pPropertySet = pWorkspaceName.ConnectionProperties
     
    Dim vName As Variant
    Dim vValue As Variant
    pPropertySet.GetAllProperties vName, vValue
     
    Dim i As Integer
     
    For i = 0 To pPropertySet.Count - 1
        Debug.Print vName(i), vValue(i)
    Next i
 
    pMxDoc.ActiveView.Refresh
    pMxDoc.UpdateContents
     
End Sub

関連記事

-ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.