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)
        ' start an edit operation
        ' add a new row
        pRow = pTable.CreateRow
        ' save/end the edit operation
        pWorkspaceEdit.StopEditOperation()     ' CRASHES HERE

    End Sub

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

Regards. Rob.