zoukankan      html  css  js  c++  java
  • join and relate

    Connect to Geodatabase (SDE)
        Dim pPropset As IPropertySet
        Set pPropset = New PropertySet
        With pPropset
          .SetProperty "Server", "griot"
          .SetProperty "Instance", "5151"
          .SetProperty "Database", ""
          .SetProperty "user", "shell"
          .SetProperty "password", "shell"
          .SetProperty "version", "SDE.DEFAULT"
        End With
            
        Dim pFact As IWorkspaceFactory
        Set pFact = New SdeWorkspaceFactory
       
        ' Open the Feature Dataset
        Dim pWorkspace As IWorkspace
        Set pWorkspace = pFact.Open(pPropset, Me.hWnd)
       
        ' Create Feature Workspace
        Dim pFeatureWorkspace As IFeatureWorkspace
        Set pFeatureWorkspace = pWorkspace
       
        ' Create Query Definition
        Dim pQueryDef As IQueryDef
        Set pQueryDef = pFeatureWorkspace.CreateQueryDef
       
        ' Provide list of tables to join
        pQueryDef.Tables = "datesjoin,dudatest"
       
        ' Retrieve the fields from all  tables
        pQueryDef.SubFields = "sde.datesjoin.dt_field = sde.dudates.dt_field"
       
        ' Set up join
        pQueryDef.WhereClause = "datesjoin.dt_field = dudates.dt_field"
       
        ' Create FeatureDataset. Note the use of .OpenFeatureQuery. The
        ' Name "MyJoin" is the name of the result of the query def
        ' and is used in place of a Feature Class name.
        Dim pFeatureDataset As IFeatureDataset
        Set pFeatureDataset = pFeatureWorkspace.OpenFeatureQuery("MyJoin", pQueryDef)
       
        'Open Layer to test against
        Dim pFeatureClassContainer As IFeatureClassContainer
        Set pFeatureClassContainer = pFeatureDataset
         
        Dim pFeatureClass As IFeatureClass
        Set pFeatureClass = pFeatureClassContainer.ClassByName("MyJoin")
  • 相关阅读:
    C++ malloc 和 new 的函数说明
    C++ const 和static的总结以及使用
    动态库与静态库的区别
    C++引用和指针的区别
    gdb的调试常用命令
    FFMPEG的函数翻译文档
    STL在数组算法的使用
    iOS开发 给Label加下划线、中划线
    更改字符串颜色(长度不确定,有服务器返回)
    iOS 获取键盘高度
  • 原文地址:https://www.cnblogs.com/zhangjun1130/p/1494256.html
Copyright © 2011-2022 走看看