Best way to edit SDE tables from .net application

442
2
05-11-2010 08:56 AM
ShawnHolyoak
Occasional Contributor
I'm struggling to understand the best method for editing columns in SDE tables from a .Net application.  My application reads rows from SDE, allows the user to modify the values in certain columns, and then writes the updated values back to SDE.

My current approach has been to create local DataTables in the application, load the records into those tables, update the values locally, and then use SQL update statements to update the values in SDE, all within an open version.  I must be doing something wrong in the versioning part, though, as my application maintains a lock on the version even after closing the state for editing (though my data is being saved).

Am I way off here in my approach?  Should I be doing this all through stored procedures on the Oracle side and calling them from my application?  Should I be trying to use the C api (which I'm not at all familiar with)?  What is everyone's preferred approach in these types of situations?  Thanks.
0 Kudos
2 Replies
BrentPierce
Esri Contributor
The best way to do this through a .NET application is to use ArcObjects. There are a number of different programming objects which can be used in the Geodatabase API that can be used to quickly and safely edit versioned tables and feature classes.

Alternatively, if your requirement is to edit versioned datasets through SQL this can also be done through use of a multi versioned view.

Hope this helps,
-Brent
0 Kudos
ShawnHolyoak
Occasional Contributor
My difficulty with the ArcObjects approach is that I'm unsure of how to match the data in my application to the SelectionSet (or other) from ArcObjects.  A bit more detail on the requirements.  I need to read a subset of data from a feature class based on a where clause.  I then need to extract matching records from a table for each row in the subset of feature class data.  I then need to present the combined set of rows to the end user, who updates information in the rows based on responses received from citizens.  I then need to update the corresponding rows in the appropriate SDE table or feature class.  How do I match up the rows from my .Net DataTable object with the appropriate row retrieved via arcobjects without doing a select query for each row in ArcObjects?

As for the multiversion view approach, that's currently the approach I'm using, using update statements against the multiversion view.  Do I not need to edit the default version and close the state when using SQL against the multiversion view?  If not, that's much simpler at this point.  Thanks.
0 Kudos