Access Connection Properties of SDE Standalone Table

651
2
06-11-2013 07:32 AM
MichaelVolz
Esteemed Contributor
To All ArcObjects Developers:

I am writing an Add_In to change the properties of a standalone SDE table in ArcMap.

I have the following code that I thought would get the connection properties, but it keeps crashing the Add-In.

pStndAloneTbl = pTableColl.StandaloneTable(k)

'Instantiate the property set object
pPropset = New PropertySet

pDataLayer2 = pStndAloneTbl

pDatasetName2 = pDataLayer2.DataSourceName
pWorkSpaceName2 = pDatasetName2.WorkspaceName

pPropset = pWorkSpaceName2.ConnectionProperties


The code crashes at pDatasetName2 = pDataLayer2.DataSourceName even though Intellisense tells me that the DataSourceName
method is available from the pDataLayer2 object.

Can anyone please tell me what I am doing wrong here as it seems to me like this code should work?

Any help or hints are greatly appreciated.
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
Try getting the connection properties from the table's workspace:

Dim table As ITable = standAloneTable.Table
Dim dataset As IDataset = DirectCast(table, IDataset)
Dim workspace As IWorkspace = dataset.Workspace
Dim props As IPropertySet = workspace.ConnectionProperties
0 Kudos
MichaelVolz
Esteemed Contributor
Thank you Neil, but the last line of your suggestion when used with Intellisense does not expose the ConnectionProperties object.

Update:

Your code did work.  I changed Workspace to Workspace2 assuming that Workspace2 was the same but just exposed additional properties.  But Workspace2 exposes less properties which include ConnectionProperties.  Once I changed it to Workspace I was able to access ConnectionProperties.
0 Kudos