I'm attempting to update both the shape and the non-spatial columns of a Shapefile. The way I do this is
'tempLayer is assigned to a Shapefile Layer that is open
'tempShape is assigned to a polygonShape I wish to update in the table
tempLayer.EditTools.BeginTransaction
dim tempColumns as String() = {"Name"}
'read in the first feature of the layer into a Feature called tempFeature
dim tempFeature as Feature = tempLayer.FeatureSource.GetFeatureByID("1",tempColumns)
tempFeature.ColumnValues("Name") = "New Name"
'update the shape
tempLayer.EditTools.Update(tempFeature.Id, tempShape)
'update the attributes
tempLayer.EditTools.Update(tempFeature)
tempLayer.EditTools.CommitTransaction()
My shape update is lost however. If I reverse the shape and attribute update statements so that the attribute update comes first, then the attribute update is lost. So, whichever update I call first appears to be overwritten with the later update and therefore has no effect. If I place a Call to CommitTransaction and BeginTransaction in between the shape and attribute updates it works just fine.
I have a few questions on this...
1) Is this the way it's supposed to work?
2) Is there a better way of updating both the shape and non-spatial columns than what I'm doing above?
3) When is it appropriate to call CommitTransaction? If I have 10 records on which I only update attribute information, do I need to call CommitTransaction 10 times or can the update to all 10 records be committed with a single call to CommitTransaction? How about for 10 shapes? And for 5 records requiring both shape and attribute updates?