Below is the piece of code (an Add-In tool) I used for updating a feature layer loaded in a .mxd
void Update_Layer(IFeatureLayer sourceLayer, IFeatureLayer targetLayer) {
IWorkspace ws = ((IDataset)targetLayer).Workspace;
IPropertySet propSet = ws.ConnectionProperties;
IVersion version = ((IVersionedWorkspace)ws).FindVersion(propSet.GetProperty("Version").ToString());
// version - myTestversion
m_workspaceEdit = (IWorkspaceEdit)version;
....
}
The targetLayer loaded in .mxd is myTestVersion. In this updating, the results show that the featureClass in both myTestVersion and SDE.Default got updated. I only want to update myTestVersion. I don't know why it happens. Thanks if you can help.