How should I get the data source of all the tables in a MXD?

Discussion created by wliang1 on May 6, 2011
Latest reply on May 17, 2011 by ujjwalesri

I try to retrieve all the tables' "data source" info in a MXD, but can't figure out how? The following is my code. Please help me finish it.

public void SetDataSource(IMxDocument mxDocument)
         ITableProperties tables = mxDocument.TableProperties;
         IEnumTableProperties ienumTable = tables.IEnumTableProperties;

         ITableProperty tableProperty = ienumTable.Next();
         while (tableProperty != null)
            //I don't know what should I do here.

Also, the most confusing part for developing ArcObject code is that how can I get the right Interface and coclass that has the desired properties for my purpose. I try to read the OMD to find the information I am looking for, but there's too many classes/coclasses. Could you tell me the right steps to code ArcObjects if I want to find something hiding somewhere in the OMDs?

Many thanks,