<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to cast COM object of type 'System.__ComObject' (to IStandAloneTable) in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624248#M16793</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Table coclass does not implement IStandAloneTable, which is why you're getting the error.&amp;nbsp; To add a standalone table to the map, you have to create a new one and set its Table property.&amp;nbsp; It's basically the same thing you do when you want to add a feature layer - create a new feature layer and set its FeatureClass property.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jun 2010 11:36:57 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2010-06-30T11:36:57Z</dc:date>
    <item>
      <title>Unable to cast COM object of type 'System.__ComObject' (to IStandAloneTable)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624247#M16792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to add a table from a MDB to a MapControl's StandAloneTableCollection, I get an error. What am I doing wrong? The table exists and is not empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Carto.IStandaloneTable'. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This operation failed because the QueryInterface call on the COM component for the interface with IID '{FFC6B179-E3EC-11D3-A096-00C04F6BC626}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; at &amp;lt;snip&amp;gt;.AddTableToMapControl() in &amp;lt;snip&amp;gt;&amp;lt;snip&amp;gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Courier New;"&gt;&lt;BR /&gt;public void AddTableToMapControl()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; IMapControl3 pMapControl = (IMapControl3)this.AxMapControl1.Object;&lt;BR /&gt;&amp;nbsp; IWorkspaceFactory accessWorkspaceFactory = new AccessWorkspaceFactoryClass();&lt;BR /&gt;&amp;nbsp; IFeatureWorkspace featureWorkspace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ITable geodatabaseTable;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IStandaloneTable geodatabaseStTable;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IStandaloneTableCollection pStTableCollection = pMapControl as IStandaloneTableCollection;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureWorkspace = accessWorkspaceFactory.OpenFromFile("c:/somewhere/somedb.mdb", 0) as IFeatureWorkspace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geodatabaseTable = featureWorkspace.OpenTable("SomeTable");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geodatabaseStTable = (IStandaloneTable)geodatabaseTable; &lt;SPAN style="color:Blue;"&gt;&amp;lt;----- here it fails with the error&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pStTableCollection.AddStandaloneTable(geodatabaseStTable);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; catch (Exception ex)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(ex.ToString());&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 08:58:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624247#M16792</guid>
      <dc:creator>PieterLinks</dc:creator>
      <dc:date>2010-06-30T08:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to cast COM object of type 'System.__ComObject' (to IStandAloneTable)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624248#M16793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Table coclass does not implement IStandAloneTable, which is why you're getting the error.&amp;nbsp; To add a standalone table to the map, you have to create a new one and set its Table property.&amp;nbsp; It's basically the same thing you do when you want to add a feature layer - create a new feature layer and set its FeatureClass property.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 11:36:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624248#M16793</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2010-06-30T11:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to cast COM object of type 'System.__ComObject' (to IStandAloneTable)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624249#M16794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Neil for your answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did as you wrote: created a new StandAloneTable, set its Table property to geodatabaseTable and tried to add it to the collection, but there it fails.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Never mind, I made a class which contains the ITable and a Name property, and put that in an ICollection - an ITableCollection doesn't have a Name property.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 13:27:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-cast-com-object-of-type-system-comobject/m-p/624249#M16794</guid>
      <dc:creator>PieterLinks</dc:creator>
      <dc:date>2010-06-30T13:27:33Z</dc:date>
    </item>
  </channel>
</rss>

