Show New SDE Connection Parameters After Running Add-In

2060
2
06-04-2013 06:23 AM
MichaelVolz
Esteemed Contributor
To All ArcGIS Developers:

I am creating an Add-In in VB.NET that will update the SDE connection parameters as the Oracle Client on individual GIS workstations is being upgraded from 10g to 11g.  When I run the script and check the connection parameters for the SDE layers it still shows sde:oracle10g even if I save the file.  I need to close the file and re-open the file to see the updated SDE connection parameters to sde:oracle11g.

Does anyone know how I can see that these SDE connection parameters have been updated without having to close and re-open the mxd that I was working on?

Any help or hints are greatly appreciated.
0 Kudos
2 Replies
MichaelVolz
Esteemed Contributor
I have added code to update the datasource of standalone tables that are sourced from an SDE database.  The coding is very similar to SDE feature classes, especially when setting the connection properties.  The behavior is odd because I can see that the connection properties of the standalone table have been updated immediately after running the Add-In, but the feature class connection properties do not appear to be updated immediately.  I need to save the mxd and then close and re-open the mxd in order to see the updated connection properties.

Does anyone know why this is occurring?

Does anyone know how to get the connection properties of SDE feature classes in mxds to show changes immediately after the Add-In has finished running?

Any help or hints are greatly appreciated.
0 Kudos
MichaelVolz
Esteemed Contributor
I have tried implementing the following code after changing my SDE datasources, but the connections are still not changing unless I close out of ArcMap:

' Get the focus map
  Dim map As ESRI.ArcGIS.Carto.IMap = mxDocument.FocusMap

  ' Cast from IMap to IActiveView
  Dim activeView As ESRI.ArcGIS.Carto.IActiveView = CType(map, ESRI.ArcGIS.Carto.IActiveView)
' Redraw the map
  activeView.Refresh()

  ' Update and Refresh TOC
  Dim contentsView As ESRI.ArcGIS.ArcMapUI.IContentsView = mxDocument.CurrentContentsView
  contentsView.Refresh(Nothing)

Does anyone know what else I need to implement to get the SDE datasource in the TOC to update while I am still in the current ArcMap session?
0 Kudos