I am trying to add a row to an ArcGIS geodatabase but I don't want an automatic objectid to be generated for this row. I want to insert a specific objectid. I get the error: field is not editable.
My code is as follows:
feature = fclass.CreateFeature();
feature.setValue((int)_fields[i].targetIndex, tripValue);
Now, in the first iteration, _fields[i].targetIndex=0 because I want to insert the specific objectid. But the first iteration gives me an error, while the rest are fine.
Any idea on how to somehow get around the automatic objectid ?
Short answer:
You don't.
Long answer:
Using the ObjectID field as a unique key (which I assume is what you're doing here) is generally considered a Very Bad Idea, as that field is not as static as you might think - various operations on the dataset will re-assign them.
One of the answers to this question suggests that copy/pasting data might transfer the objectids intact, if you're copying data from somewhere else, but otherwise you should create another field to use as the unique key and leave the objectid alone.
(incidentally, this kind of geodatabase question will get much more intelligent answers over at GIS.SE.