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?

  • 1
    Why not just use ODP.net instead? Nov 17 '11 at 3:18
  • 1
    I'm not sure why you'd want to use ArcObjects to do that. Wouldn't it be more efficient to edit it using SQL through OLEDB? Nov 17 '11 at 11:29

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

Dim pRow As IRow = pTable.GetRow(1235) 'get particular Row to update
pRow.Value(pRow.Fields.FindField("NAME")) = "A NEW NAME"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.