Can an ODBC Oracle table attached by OLE within ArcMap be edited/updated by using ArcObjects? If so, what are the procedural steps for doing this?
Are there code examples out there showing how to do this?
I can understand why you would like to use ArcObjects instead of ADO to update or read the business tables.
When ArcMap connects to your Geodatabase, it establishes a dedicated connection called a Workspace. It seems like a waste of memory and resources to establish another connection via ADO to your geodatabase while you have an existing connection which you can use. This is especially valid when you have multiple users, spawning two connections for each user can seem inefficient.
To update or read your table from ArcMap you have to get hold of the workspace somehow. This easy way is to get it from the first layer. Following code is in VB.NET
Dim pWorkspace as IWorkspace Dim pMxdoc as ImxDocument = application.document ' get the arcmap document Dim pFLayer as IFeatureLayer = pMxdoc.FocusMap.Layers(0) Dim pDS as IDataset = pFLayer.FeatureClass pWorkspace = pDs.Workspace
now that we have the workspace you can use it to open your table by name, and update the name field of record having object id 1235
Dim pFWorkspace As IFeatureWorkspace Dim pTable As ITable = pFWorkspace.OpenTable("mytablename") 'start editing Dim pEWorkspace As IWorkspaceEdit = pWorkspace pEWorkspace.StartEditing(False) pEWorkspace.StartEditOperation() Dim pRow As IRow = pTable.GetRow(1235) 'get particular Row to update pRow.Value(pRow.Fields.FindField("NAME")) = "A NEW NAME" pRow.Store() pEWorkspace.StopEditOperation() pEWorkspace.StopEditing(True)