rkoc

Editing History/Archive Table using ArcObjects ??? VB.Net

Discussion created by rkoc on Jul 17, 2010
Hi All,

I have a polyline feature class in a geodatabase. This feature class is registered as versioned and has Archiving enabled.

I would like to know if/how one would go about editing the history/archive table using ArcObjects. I am interested in adding new records to the history/archive table programmatically. I???m sure doing so probably does not come highly recommended, but none the less, it???s an avenue which I would like to prove/disprove.

Here???s what I have tried, without luck (ArcMap Crashes):

 Private Sub editHistoryTable()

        ' set and conect to the database workspace
        Dim pFeatureWorkspace As IFeatureWorkspace = dbConnection()
        Dim pFeatureClass As IFeatureClass = Nothing

        ' access the history table
        Dim pTable As ITable = pFeatureWorkspace.OpenTable("Road_H")
        pFeatureClass = pTable
        Dim pRow As IRow

        ' set the edit envionment
        Dim pMultiuserWorkspaceEdit As IMultiuserWorkspaceEdit = CType(pFeatureWorkspace, IMultiuserWorkspaceEdit)
        Dim pWorkspaceEdit As IWorkspaceEdit = CType(pFeatureWorkspace, IWorkspaceEdit)

        ' start nonversioned edit (I assume the history table itself is not versioned)
        pMultiuserWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMNonVersioned)
        ' start an edit operation
        pWorkspaceEdit.StartEditOperation()
        ' add a new row
        pRow = pTable.CreateRow
        pRow.Store()
        ' save/end the edit operation
        pWorkspaceEdit.StopEditOperation()     ' CRASHES HERE
        pWorkspaceEdit.StopEditing(True)

    End Sub


I am using 9.3.1 SP1 and a SDE Personal Geodatabase.
Any help would be much appreciated.

Regards. Rob.

Outcomes