Get broken sde datasource name

1839
2
12-16-2014 09:00 PM
prashantk
New Contributor III

Hi All,

I am trying to change sde datasource using arcobject.If SDE connection is working then i can retrieve datasource name using IDataLayer interface.

IDataLayer dataLayer = (IDataLayer)sourceLyr;

               

IName dsName= dataLayer.DataSourceName;

But if connection is broken(red mark in TOC layer) then datasource is returning null value. My datasource name and layer name in TOC is different.

How to retrieve broken dataset name? Any help would be appreciated.

0 Kudos
2 Replies
MuhammadAttique
New Contributor III

Hi prashant k,

How you update the connection, when MXD open,

or try to disconnect first and then connect to restore the connection - update it and call IApplication to savedocument.

or you can visit ESRI's help link , may be helpful for you .

ArcGIS Desktop   http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000

0 Kudos
prashantk
New Contributor III

Hi Muhammad,

I am trying to achieve this using arcobjeci api.I have created customized tool to find and replace sde connection for existing layer and this should work if connection is not present in arc catalog.

Either connection is not available you can see details in layer properties.I am trying to get this details using api but no success..

0 Kudos