Oracle スタンドアロン テーブルを直接更新する方法

'ArcSDEと同居しているOracleスタンドアロンテーブルに対して更新する方法
'IWorkspace::ExecuteSQL:SQLを発行できるが戻り値が取得できない
'ITransactions:編集セッション外でトランザクションを制御するのに使用
'使用ライセンスはEditor以上,Geodataabse Updateを使用すること
'ESRI Support #631518
'IWorkspace::ExecuteSQL


Try

     Dim pPropset As ESRI.ArcGIS.esriSystem.IPropertySet
     pPropset = New ESRI.ArcGIS.esriSystem.PropertySet

     '++ Create a new workspacefactory/workspace
     Dim pWorkspaceFact As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory
     pWorkspaceFact = New ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactory

     With pPropset
         .SetProperty("SERVER", "hawkeye")
         .SetProperty("INSTANCE", "6161")
         .SetProperty("USER", "sde")
         .SetProperty("PASSWORD", "sdesde")
         .SetProperty("VERSION", "SDE.DEFAULT")
     End With


     Dim pWorkspace As ESRI.ArcGIS.Geodatabase.IWorkspace
     pWorkspace = pWorkspaceFact.Open(pPropset, 0)


     Dim SQLstr As String
     SQLstr = "create view SDE.TableVIEW_1A as select * from SDE.us_counties wheE_NAME = 'Washington'"

     pWorkspace.ExecuteSQL(SQLstr)

     Dim pFeatWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace
     pFeatWorkspace = pWorkspace

     '++ Get the datasets (names) in the workspace
     Dim pEnumDataset As ESRI.ArcGIS.Geodatabase.IEnumDatasetName
     pEnumDataset = pWorkspace.DatasetNames(ESRI.ArcGIS.Geodatabase.esriDatasetTiDTTable)

     '++ Create a new dataset object for the table you want to load
     Dim pDataset As ESRI.ArcGIS.Geodatabase.IDatasetName
     pDataset = pEnumDataset.Next

     ''''''''''''''''''''''''''''''''''''
     Dim tableViewName As String
     Do Until pDataset Is Nothing
         If pDataset.Name = "SDE.TableVIEW_1A" Then
             Debug.Print(pDataset.Name)
             tableViewName = pDataset.Name
             Debug.Print(tableViewName)
             Exit Do
         End If
         pDataset = pEnumDataset.Next
     Loop


     '++ Create and open the new table object from the dataset name
     Dim pTable As ESRI.ArcGIS.Geodatabase.ITable
     pTable = pFeatWorkspace.OpenTable(pDataset.Name)


     '++ Create a table collection and assign the new table to it
     Dim pStTab As ESRI.ArcGIS.Carto.IStandaloneTable
     Dim pStTabColl As ESRI.ArcGIS.Carto.IStandaloneTableCollection
     Dim pMap As ESRI.ArcGIS.Carto.IMap
     Dim mx As ESRI.ArcGIS.ArcMapUI.IMxDocument
     mx = m_app.Document
     pMap = mx.FocusMap
     pStTab = New ESRI.ArcGIS.Carto.StandaloneTable
     pStTab.Table = pTable
     pStTabColl = pMap
     pStTabColl.AddStandaloneTable(pStTab)

     '++ Update the document
     mx.UpdateContents()

     '++ Create and open a new table window for the table
     Dim ptabWin As ESRI.ArcGIS.ArcMapUI.ITableWindow
     ptabWin = New ESRI.ArcGIS.ArcMapUI.TableWindow
     ptabWin.Table = pTable
     ptabWin.ShowAliasNamesInColumnHeadings = True
     ptabWin.Application = m_app
     ptabWin.Show(True)

 Catch ex As Exception

     System.Windows.Forms.MessageBox.Show(ex.Message.ToString())

 End Try


'ITransActions::AbortTransaction
Sub AddRow()

    Dim tableName As String
    Dim databasePath As String
    databasePath = "C:\test_data\test.mdb"
    tableName = "test"
    Dim pPropset As IPropertySet
    Dim pWF As IWorkspaceFactory
    Dim fWS As IFeatureWorkspace
    Dim pTable As ITable
    Dim pCursor As ICursor
    Dim pRow As IRow
    
    Set pPropset = New PropertySet
    pPropset.SetProperty "DATABASE", databasePath
    pPropset.SetProperty "DATAPROVIDER", "Access Data Source"
    
    Set pWF = New AccessWorkspaceFactory
    Set fWS = pWF.Open(pPropset, 0)
    
    Dim pTransActions As ITransactions
    Set pTransActions = fWS
    
    'Start the transaction
    pTransActions.StartTransaction
    
    
    'Open the Table
    Set pTable = fWS.OpenTable(tableName)
        
    'Create new row and populate with values
    Set pRow = pTable.CreateRow
    pRow.Value(4) = "Test_1"
    pRow.Value(5) = "Test_2"
    pRow.Store
    
    'Abort the transaction
    pTransActions.AbortTransaction
    
    ''Use ITransactions::CommitTransaction to commit the changes
    'pTransActions.CommitTransaction

End Sub