Versioned edit with ArcObjects C#

981
2
04-13-2021 10:50 PM
forestknutsen1
MVP Regular Contributor

Can someone please point me to a good example for using versioned editing with a C#? I am working on a console application to edit attributes in a sde geodatabase.

The below is working for non-versioned tables.

 

           Console.WriteLine("start editing");
           IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
           workspaceEdit.StartEditing(false);
           workspaceEdit.StartEditOperation();
           TestFeature.Value[fieldIndex] = testString;
           TestFeature.Store();
           workspaceEdit.StopEditOperation();
           workspaceEdit.StopEditing(true);
           Console.WriteLine("editing stopped");

 

 

Thanks!

Tags (1)
0 Kudos
2 Replies
forestknutsen1
MVP Regular Contributor

No, not yet....

0 Kudos
SherryVotava
New Contributor II

You'll need to use iVersionedWorkspace and iVersion.  Something like this prior to the code you shared...

pVersionedWorkspace = pWorkspace

pVersion = pVersionedWorkspace.FindVersion("myversion")

'check to make sure pVersion is not nothing

pWorkspace = pVersion

0 Kudos