myozaahmad

editing geodatabase

Discussion created by myozaahmad on May 17, 2010
I develop desktop application using arcgis engine (c#) for editing sde geodatabase.
my code :

            bStartEdit = chkEditSession.Checked;
            //start or stop the edit session; update the caption on the control (start/stop editing)
            if (bStartEdit)
            {
                if (m_engineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
                    return;
                //function that returns the selected layer
           
                axEditorToolbar.SetBuddyControl(axMapControl1);
                //Initialize the application.
                esriLicenseStatus licenseStatus = esriLicenseStatus.esriLicenseUnavailable;
                IAoInitialize m_AoInitialize = new AoInitializeClass();
                licenseStatus = m_AoInitialize.Initialize
                  (esriLicenseProductCode.esriLicenseProductCodeArcInfo);

                IFeatureLayer lyr = GetCurrentLayer();
                IDataset ds = (IDataset)lyr;
                //IWorkspace ws = ds.Workspace; //get workspace

                // Create a set of connection properties.
                IPropertySet propertySet = new PropertySetClass();
                propertySet.SetProperty("SERVER", "gis");
                propertySet.SetProperty("INSTANCE", "sde:oracle11g"); //sde:oracle11g atau esri_sde
                propertySet.SetProperty("USER", "sde");
                propertySet.SetProperty("PASSWORD", "admin@spatial");
                propertySet.SetProperty("VERSION", "sde.DEFAULT");

                Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
                IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance
                    (factoryType);
                IWorkspace workspace = workspaceFactory.Open(propertySet, 0);
               
//Open the feature class that will be edited.
                IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
                IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("SDE.aceh_tanah_region_1");

                // Start a non-versioned edit session on the workspace.
                IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)featureWorkspace;
                IMultiuserWorkspaceEdit muWorkspaceEdit = (IMultiuserWorkspaceEdit)featureWorkspace;
                muWorkspaceEdit.StartMultiuserEditing
                    (esriMultiuserEditSessionMode.esriMESMNonVersioned);

                // Within an edit operation, retrieve and delete a single feature.
                workspaceEdit.StartEditOperation();
                IFeature feature = featureClass.GetFeature(1);
                m_engineEditor.StartEditing(workspace, axMapControl1.Map);
                workspaceEdit.StopEditOperation();
               
                // Stop editing, specifying that the edit should be saved. Use a value of false here to discard edits.
                workspaceEdit.StopEditing(true);



but  get error in line "m_engineEditor.StartEditing(workspace, axMapControl1.Map);".
u can see that error in Attached Images.
Please tell me how to fix this problem?

thanks

Attachments

Outcomes