bwengineering

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

Discussion created by bwengineering on Dec 9, 2011
Latest reply on Dec 10, 2011 by Hornbydd
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")

Outcomes