Select to view content in your preferred language

Get a reference to a non-spatial data table on the source tab

2052
1
12-09-2011 12:51 PM
BrianWestfall
Emerging Contributor
I need to query a table that has non spatial data and is available on the source tab.  If I physically select the table, the code below code works.  I don't want to be required to select the table in order to get the table reference and do the query.  Can someone tell me how to do this using the table name?

Thanks
Brian

Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = CType(My.ArcMap.Application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument)

Dim contentsView As ESRI.ArcGIS.ArcMapUI.IContentsView = mxDocument.ContentsView(1) ' 0 = usually the Display tab, 1 = usually the Source tab

Dim table As ESRI.ArcGIS.Geodatabase.ITable = CType(contentsView.SelectedItem, ESRI.ArcGIS.Geodatabase.ITable)
  
Dim cursor As ICursor = PerformAttributeQuery(table, "OBJECTID = 1")
0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor
You want to use the Interface IStandaloneTableCollection.
0 Kudos