laptop and a wrench

漏洞

AddJoin gives error when joining a SqlServer table with no ObjectID.

上次发布: August 25, 2014 ArcGIS for Desktop
漏洞 ID 编号 NIM039018
已提交October 3, 2008
上次修改时间June 5, 2024
适用范围ArcGIS for Desktop
找到的版本9.3
操作系统Windows OS
操作系统版本XP
状态Duplicate

附加信息

Duplicate of NIM038601

解决办法

Use ArcObjects code IMemoryRelationshipClassFactory & IDisplayRelationshipClassSee sample below.Public Sub joinATable() On Error GoTo EH Dim pDoc As IMxDocument Dim pMap As IMap Set pDoc = ThisDocument Set pMap = pDoc.FocusMap ' Get the first layer in the table on contents Dim pFeatLayer As IFeatureLayer Dim pDispTable As IDisplayTable Dim pFCLayer As IFeatureClass Dim pTLayer As ITable If pMap.LayerCount = 0 Then MsgBox "Must have at least one layer" Exit Sub End If Set pFeatLayer = pMap.Layer(0) Set pDispTable = pFeatLayer Set pFCLayer = pDispTable.DisplayTable Set pTLayer = pFCLayer ' Get the first table in the table on contents Dim pTabCollection As IStandaloneTableCollection Dim pStTable As IStandaloneTable Dim pDispTable2 As IDisplayTable Dim pTTable As ITable Set pTabCollection = pMap If pTabCollection.StandaloneTableCount = 0 Then MsgBox "Must have atleast one table" Exit Sub End If Set pStTable = pTabCollection.StandaloneTable(0) Set pDispTable2 = pStTable Set pTTable = pDispTable2.DisplayTable ' Create virtual relate Dim pMemRelFact As IMemoryRelationshipClassFactory Dim pRelClass As IRelationshipClass Set pMemRelFact = New MemoryRelationshipClassFactoryDim strJoiningFieldinTable As StringDim strJoiningFIeldinFeatureClass As StringstrJoiningFieldinTable = "inty"strJoiningFIeldinFeatureClass = "Fid" Set pRelClass = pMemRelFact.Open("TabletoLayer", pTTable, strJoiningFieldinTable, pTLayer, _ strJoiningFIeldinFeatureClass, "forward", "backward", esriRelCardinalityOneToOne) ' use Relate to perform a join Dim pDispRC As IDisplayRelationshipClass Set pDispRC = pFeatLayer pDispRC.DisplayRelationshipClass pRelClass, esriLeftOuterJoin MsgBox ("done") Exit SubEH: MsgBox Err.Number & " " & Err.Description End Sub

重现步骤

漏洞 ID: NIM039018

软件:

  • ArcGIS for Desktop

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项