Retrieve Table Datasource Type

1759
3
Jump to solution
04-23-2013 09:39 AM
Occasional Contributor II
I'm trying to get at the data source type of a table in the Table of contents. I usually do this with Feature Layers which is as simple as featureLayer.DataSourceType. The ITable interface has no such property. I can't seem to get at the Table as a Layer. Is there some casting I'm not doing properly? I see the IDataSourceInformation Interface. Is that something I can use?

Any help is appreciated. If you'd like to see code I'll reply. I just need to know which objects to use.

-Corbin de Bruin
Reply
0 Kudos
1 Solution

Accepted Solutions
MVP Honored Contributor
You have to use IStandaloneTable to get the tables in the TOC. You can QI to an IDataset to get its source

IMxDocument pMxdoc = m_application.Document;      IMap pMap = pMxdoc.FocusMap;      IStandaloneTableCollection pStandAloneTableCollection = pMap;      IStandaloneTable pStandalonetable = null;      for (int i = 0; i <= pStandAloneTableCollection.StandaloneTableCount - 1; i++)      {          pStandalonetable = pStandAloneTableCollection.StandaloneTable(i);         IDataset pDataset = (IDataset)pStandaloneTable;         Messagebox.show(pStandalonetable.Name & ": " & pDataset.Category);      } 

View solution in original post

Reply
0 Kudos
3 Replies
MVP Honored Contributor
You have to use IStandaloneTable to get the tables in the TOC. You can QI to an IDataset to get its source

IMxDocument pMxdoc = m_application.Document;      IMap pMap = pMxdoc.FocusMap;      IStandaloneTableCollection pStandAloneTableCollection = pMap;      IStandaloneTable pStandalonetable = null;      for (int i = 0; i <= pStandAloneTableCollection.StandaloneTableCount - 1; i++)      {          pStandalonetable = pStandAloneTableCollection.StandaloneTable(i);         IDataset pDataset = (IDataset)pStandaloneTable;         Messagebox.show(pStandalonetable.Name & ": " & pDataset.Category);      } 

View solution in original post

Reply
0 Kudos
Occasional Contributor II
Thank you. For future reference, how do I find lists of ArcObjects Interfaces that QI nicely?
Reply
0 Kudos
MVP Honored Contributor
If you look at the IStandaloneTable reference, click on the StandaloneTable CoClass that implements it, which takes you to the list of interfaces it works with.
Reply
0 Kudos