3 Replies Latest reply on Jul 6, 2015 8:13 AM by Ed Blair

    ElectricDataset Edit from C# .NET

    Jafeth Carrillo Salas

      Hi,

       

      I'm neebie in ArcGIS development. I try edit a field of DynamicProtectiveDevice (FeatureClass) in the ElectricDataset, but without success. I use the same code on a table outside the dataset and in this case if it works. I could indicate whether there are any special condition for these tables?, and if possible editing via C#?, and if possible what type of object that I use. This is the code I am using...

       

       

                      featureWorkSpace = (IFeatureWorkspace)pWorkSpace; //transformar el workspace

                      featureClass = featureWorkSpace.OpenFeatureClass("SIGEL.DynamicProtectiveDevice");

                      IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)pWorkSpace;

                      IMultiuserWorkspaceEdit muWorkspaceEdit = (IMultiuserWorkspaceEdit)workspaceEdit; // This was a test, not neccesary

                      muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);

                      workspaceEdit.StartEditing(true);

                      workspaceEdit.StartEditOperation();

                      IFeatureCursor cursorInterruptores = featureClass.Search(null, false); // I try also with featureClass.Update(null,false);

                      IFeature filaInterruptor = null;

                      int indexObj = featureClass.Fields.FindField("OBJECTID");

                      int indexNPA = featureClass.Fields.FindField("HORA");

                      while ((filaInterruptor = cursorInterruptores.NextFeature()) != null)

                          {

                              objectID = filaInterruptor.get_Value(indexObj).ToString().Trim(); //tomar el objectid

                              //idInterruptor = filaInterruptor.get_Value(indexFac).ToString().Trim();

                              try

                              {

                                  filaInterruptor.set_Value(indexNPA, "08:00");

                                  filaInterruptor.Store();

                                  // cursorInterruptores.UpdateFeature(filaInterruptor); // I use this with featureClass.Update(null,false);

                                  cont++;

                              }

                              catch {

                                  .....                      

                              }

                          }

                      workspaceEdit.StopEditOperation();

                      workspaceEdit.StopEditing(true);

       

      I use Visual Studio 2013, ArcGIS 10.0, DeveloperKit 10.0, DotNet 10.2.5

       

      Thanks in advance !!!

       

      Jafeth