<?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: Can't open FGDB in console application in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664976#M17843</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactory();&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;You should never use New to instantiate an instance of a singleton object.&amp;nbsp; Use the Activator class instead.&amp;nbsp; See the following help topic for more info.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/"&gt;http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My issue was actually related to creating a new fgdb vs referencing an existing one, but your response got me on the path and bettered my code in other ways.&amp;nbsp; Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jul 2013 17:33:43 GMT</pubDate>
    <dc:creator>JacobMundt1</dc:creator>
    <dc:date>2013-07-29T17:33:43Z</dc:date>
    <item>
      <title>Can't open FGDB in console application</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664974#M17841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, Getting back on the horse after a couple of years in a non-technical position. I am trying to write a console application that iterates through a fc in a FGDB and updates values. Having trouble opening the FGDB. The code below binds, checks out, and verifies that I have checked out a desktop advanced license, but fails on the very last line, opening the FGDB (the first objects command).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Win7, 10.1 Desktop, c# Visual Studio Express 2010 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Error: Error HRESULT E_FAIL has been returned from a call to a COM component (no details)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console says license checkout was successful&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks in advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;static void OpenFGDB()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//get and verify the license&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI.ArcGIS.esriSystem.AoInitialize aoInit = null;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;aoInit = new AoInitializeClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (aoInit.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeAdvanced) == esriLicenseStatus.esriLicenseAvailable)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;esriLicenseStatus licStatus = aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if (licStatus == esriLicenseStatus.esriLicenseCheckedOut)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine("ArcGIS Advnaced License Checkout Successful.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine("ArcGIS Advanced License is availble but could not be checked out, program exiting.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine("Press any key to exit.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.ReadKey();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Environment.Exit(0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine("ArcGIS Advanced License not available, program exiting.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine("Press any key to exit.");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.ReadKey();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Environment.Exit(0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;catch (Exception exc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Console.WriteLine(exc.Message);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//open the fgdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactory();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile("@C:\temp\test.gdb", 0); //fails here&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 16:22:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664974#M17841</guid>
      <dc:creator>JacobMundt1</dc:creator>
      <dc:date>2013-07-29T16:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can't open FGDB in console application</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664975#M17842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="plain" name="code"&gt;IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactory();&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You should never use New to instantiate an instance of a singleton object.&amp;nbsp; Use the Activator class instead.&amp;nbsp; See the following help topic for more info.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/" rel="nofollow" target="_blank"&gt;http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 16:31:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664975#M17842</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-07-29T16:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can't open FGDB in console application</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664976#M17843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactory();&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;You should never use New to instantiate an instance of a singleton object.&amp;nbsp; Use the Activator class instead.&amp;nbsp; See the following help topic for more info.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/"&gt;http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My issue was actually related to creating a new fgdb vs referencing an existing one, but your response got me on the path and bettered my code in other ways.&amp;nbsp; Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2013 17:33:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/can-t-open-fgdb-in-console-application/m-p/664976#M17843</guid>
      <dc:creator>JacobMundt1</dc:creator>
      <dc:date>2013-07-29T17:33:43Z</dc:date>
    </item>
  </channel>
</rss>

