I have a custom .net extension tool that is supposed to connect to a file geodatabase or SDE (SQL Server). The SDE connection fails to recognize it as valid. The file geodatabase connection works just fine.
- The .net tool connects to SDE in ArcMap 10.0 just fine.
- Outside the .net extension tool - I can make an SDE (SQL Server Enterprise) connection.
Also...I just learned...the connection is successful when the path is pasted into the text box and connected. It would appear for whatever reason the program is not entering the path of database in 10.2 but it does for 10.0. Not sure why.
Private Sub BrowseSDE()
Dim pBrowser As ESRI.ArcGIS.CatalogUI.IGxDialog = Nothing
Dim pEnumGX As ESRI.ArcGIS.Catalog.IEnumGxObject = Nothing
Dim pGXFilter As ESRI.ArcGIS.Catalog.IGxObjectFilter = Nothing
Dim pGXObject As ESRI.ArcGIS.Catalog.IGxObject = Nothing
Dim pFolder As ESRI.ArcGIS.Catalog.IGxRemoteDatabaseFolder = Nothing
Dim pName As ESRI.ArcGIS.esriSystem.IName = Nothing
Static strStartingLocation As String
Dim bFlag As Boolean
Try
'NEW DIALOG...
pBrowser = New ESRI.ArcGIS.CatalogUI.GxDialog
'FILTER FOR SDE WORKSPACES...
pGXFilter = New ESRI.ArcGIS.Catalog.GxFilterWorkspaces
'SETUP THE BROWSER
With pBrowser
.Title = "Select SDE Geodatabase Connection File"
.ButtonCaption = "Select"
.AllowMultiSelect = False
.RememberLocation = True
End With
'SET THE FILTER
pBrowser.ObjectFilter = pGXFilter
'OPEN AT LAST LOCATION
'pBrowser.StartingLocation = strStartingLocation
'OPEN THE BROWSER
bFlag = pBrowser.DoModalOpen(Me.Handle.ToInt32, pEnumGX)
'SAVE CURRENT LOCATION
strStartingLocation = pBrowser.FinalLocation.FullName
'MAKE SURE SOMETHING WAS SELECTED
If bFlag = False Then Exit Sub
'RESET
pEnumGX.Reset()
'SET SELECTED OBJECT
pGXObject = pEnumGX.Next
Do While Not pGXObject Is Nothing
pName = pGXObject.InternalObjectName
If pGXObject.Category = "Spatial Database Connection" Then
pFolder = pGXObject.Parent
Me.txtPath.Text = pFolder.Path & "\" & GetPathName((pGXObject.FullName), 1)
Else
DevComponents.DotNetBar.MessageBoxEx.Show("Please select a valid Database Connection (SDE)")
Me.txtPath.Text = ""
End If
pGXObject = pEnumGX.Next
Loop
Catch ex As Exception
ErrorHandler.ShowErrors(ex, "Debug", "Error with BrowseSDE")
log.Debug("Error with BrowseSDE", ex)
End Try
End Sub
Private Sub BrowsePGDB()
Try
Dim pBrowser As ESRI.ArcGIS.CatalogUI.IGxDialog = Nothing
Dim pEnumGX As ESRI.ArcGIS.Catalog.IEnumGxObject = Nothing
Dim pGXFilter As ESRI.ArcGIS.Catalog.IGxObjectFilter = Nothing
'NEW DIALOG...
pBrowser = New ESRI.ArcGIS.CatalogUI.GxDialog
'FILTER FOR PERSONAL GEODBS...
pGXFilter = New ESRI.ArcGIS.Catalog.GxFilterPersonalGeodatabases
'SET THE FILTER
pBrowser.ObjectFilter = pGXFilter
'SETUP THE BROWSER
With pBrowser
.Title = "Select a Streams Personal/File Geodatabase"
.ButtonCaption = "Select"
.AllowMultiSelect = False
.RememberLocation = True
End With
'OPEN THE BROWSER
pBrowser.DoModalOpen(Me.Handle.ToInt32, pEnumGX)
'MAKE SURE SOMETHING WAS SELECTED
If pBrowser.InternalCatalog.SelectedObject Is Nothing Then Exit Sub
'SLAP THE PATH INTO txtPath
Me.txtPath.Text = pBrowser.InternalCatalog.SelectedObject.FullName
cmdUpdate.Visible = Me.txtPath.Text <> ""
Catch ex As Exception
ErrorHandler.ShowErrors(ex, "Debug", "Error with BrowsePGDB")
log.Debug("Error with BrowsePGDB", ex)
End Try
End Sub
Aucun commentaire:
Enregistrer un commentaire