Error with ArcEngine 10.3 Mapping

4345
1
01-12-2015 04:53 AM
PaulCole
New Contributor

I have just move over to Arc Engine 10.3 from 10.2 and re-compiled the software, but I am now getting an error being thrown up when trying to create A GDB File.

I am using the following code, it create the blank File GDB Database but when it comes to the workspaceFactory.Open instruction it throws up a COM Exception error of 0x80040228

 

 

IWorkspaceName workspaceName;

 

            propertySet = new PropertySetClass();

            workspaceFactory = new FileGDBWorkspaceFactory();

 

 

            DirectoryInfo di = new DirectoryInfo(directory + @"\" + fileName + ".gdb");

            if (di.Exists)

            {

 

            }

            else

            {

                workspaceName = workspaceFactory.Create(amsDir, fileName + ".gdb", null, 0);

 

            }

 

            propertySet.SetProperty("DATABASE", amsDir + @"\" + fileName + ".gdb");

            workspace = workspaceFactory.Open(propertySet, 0);

 

            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);

            workspaceEdit.StartEditOperation();

 

Under the license I am using the same as the 10.2 version ( ArcEngine & ArcEngine Enterprise GeoDatabase )

The ArcGIS administrator is showing that I have the EDN Subscription covering 10.3

 

I need a solution ASAP.

 

Paul Cole

Tags (2)
0 Kudos
1 Reply
FreddieGibson
Occasional Contributor III

Have you tried using the Activator to instantiate the workspace?

  // Instantiate a file geodatabase workspace factory and create a file geodatabase.
  // The Create method returns a workspace name object.
  Type factoryType = Type.GetTypeFromProgID(
   "esriDataSourcesGDB.FileGDBWorkspaceFactory");
  IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance
  (factoryType);
  IWorkspaceName workspaceName = workspaceFactory.Create(path, "Sample.gdb", null,
  0);

   // Cast the workspace name object to the IName interface and open the workspace.
  IName name = (IName)workspaceName;
  IWorkspace workspace = (IWorkspace)name.Open();
   return workspace;

Creating Geodatabase

http://help.arcgis.com/en/sdk/10.0/Arcobjects_net/conceptualhelp/index.html#//0001000004t8000000

0 Kudos