SDE数据提交编辑冲突:“The Version has been redefined to reference a new database state .[sde.default]”

    一、问题

    多人同时用SDE用户编辑同一SDE数据库中得DEFAULT版本,在STOPEDITING提交编辑时报错:“The Version has been redefined to reference a new database state .[sde.default]”。

    二、分析

    引用官方的分析:

    The StopEditing method is used to end an edit session. The saveEdits parameter controls if edits are saved or discarded. A multi-versioned database can support multiple concurrent edit sessions on the same version of the database. In such a scenario, StopEditing will return an error code of FDO_E_VERSION_REDEFINED if it detects that the database state associated with the version being edited is no longer the same as it was at the beginning of the edit session (indicating that the version was modified by some other edit session). In this case the application is responsible for calling the IVersionEdit::Reconcile method to reconcile the edit session against the current state of the version being edited. StopEditing may be called again after reconciliation.

    三、解决方案

    在保存的时候加上一段代码:

    Dim pVersion As IVersion Set pVersion = g_pWorkSpace Dim pVerWorkspace As IVersionedWorkspace Set pVerWorkspace = g_pWorkSpace Dim pVersionEdit As IVersionEdit Set pVersionEdit = pVerWorkspace Dim Success As Boolean Success = pVersionEdit.Reconcile("SDE.DEFAULT")

    然后在保存一次,运行可以通过,不过好像还是会影响其他用户对该图层的编辑结果。

posted @ 2011-09-14 10:38  海平  阅读(2057)  评论(0编辑  收藏  举报