suneelhere

Unable to Update feature attributes

Discussion created by suneelhere on Jul 18, 2011
Latest reply on Jul 21, 2011 by suneelhere
This is what i've done in my arcmap class library:


ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();

                propertySet.SetProperty("SERVER", "172.16.8.148");
                propertySet.SetProperty("INSTANCE", "ESRI_SDE");
                propertySet.SetProperty("DATABASE", "ARCGIS_SCADA");
                propertySet.SetProperty("USER", "sde");
                propertySet.SetProperty("PASSWORD", "smartgrid");
                propertySet.SetProperty("VERSION", "SDE.DEFAULT");
                propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");

IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
                IWorkspace workspace = workspaceFactory.Open(propertySet, 0);
                try
                {
                    //Cast to IFeatureWorkspace.
                    IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
                    IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("SDE.SCADA_FINAL_CB");
                  
                    //Cast to IFeatureWorkspace.
                    IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
                    workspaceEdit.StartEditing(true);

                    // Start an edit operation and create a cursor.
                    workspaceEdit.StartEditOperation();

                    if (workspaceEdit.IsBeingEdited())
                    {
                        // Find the index of the field to edit.
                        int typeFieldIndex = featureClass.FindField("STATE");
                       
                        IQueryFilter queryFilter = null;
                        IFeatureCursor searchCursor = null;
                        IFeature feature = null;

                            queryFilter = new QueryFilterClass();
                            queryFilter.WhereClause = "OBJ_NAME='object'";
                            searchCursor = featureClass.Update(queryFilter, false);

                          
                            while ((feature = searchCursor.NextFeature()) != null)
                            {
                                feature.set_Value(typeFieldIndex, o.Value);
                                feature.Store();
                                searchCursor.UpdateFeature(feature);
                                // Since the edit operation is ending, release the cursor.
                                Marshal.ReleaseComObject(searchCursor);                

                            }

                        mxDoc.ActiveView.Refresh();

                         //Stop the edit operation.
                        workspaceEdit.StopEditOperation();
                        workspaceEdit.StopEditing(true);
                       
                    }
                }

now if i see the arcmap and check out the feature for update(value change in field), im not getting the updated one.
If i click "start editing" from the editor dropdown menu, im able to find the update in attributes table. It is working even if the arcmap window is closed and opened again.
I want to get the updates without any manual operation.

Outcomes