I'm developing an ArcMap extension and looking for a way to change feature attributes knowing its feature class and OID (and, presumably, everything else that there is in IFeature
). All layers use ArcSDE datasets.
What's the right way to do it? Should I change the data in database? It feels like I shouldn't but I can't figure out how to change feature fields values using ArcObjects. The documentation for ArcObjects looks incomplete and awkward to use.
Background info: the extension provides a custom tool that processes selected feature and changes one of its attributes. Now, feature processing involves calling a remote service so it's an asynchronous operation and I should place all my updating logic in the callback method. The tool should work with any of the project layers all of which are ArcSDE datatsets. That's basically the requirements.
If anyone can help me with an advice or a working sample, I would be really grateful. Thanks in advance.
Best Answer
Below are a couple of extension methods for IFeature/IRow that show the actual setting of a value. You'll want to check out cursors and row/feature buffers if you need better performance: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/d/0001000002rs000000.htm
the extension methods would need to be called when you are already in an edit operation (editor.StartOperation()/editor.StopOperation()): http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/abbd6e92-04f8-4957-a205-a53773fbf023.htm