Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Can't open FGDB in console application

$
0
0
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).

Win7, 10.1 Desktop, c# Visual Studio Express 2010
Error: Error HRESULT E_FAIL has been returned from a call to a COM component (no details)
Console says license checkout was successful

thanks in advance


static void OpenFGDB()
{

//get and verify the license
ESRI.ArcGIS.esriSystem.AoInitialize aoInit = null;
try
{
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
aoInit = new AoInitializeClass();
if (aoInit.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeAdvanced) == esriLicenseStatus.esriLicenseAvailable)
{
esriLicenseStatus licStatus = aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);
if (licStatus == esriLicenseStatus.esriLicenseCheckedOut)
{
Console.WriteLine("ArcGIS Advnaced License Checkout Successful.");
}
else
{
Console.WriteLine("ArcGIS Advanced License is availble but could not be checked out, program exiting.");
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
Environment.Exit(0);
}
}
else
{
Console.WriteLine("ArcGIS Advanced License not available, program exiting.");
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
Environment.Exit(0);
}
}
catch (Exception exc)
{
Console.WriteLine(exc.Message);
}


//open the fgdb
IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactory();
IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile("@C:\temp\test.gdb", 0); //fails here

}

Viewing all articles
Browse latest Browse all 1374

Trending Articles