By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

Connection Properties Dialog Box?

P: n/a
Hi! I am creating a Windows app in VS2005 which will allow the user to
choose from different SQL data sources. I could hardcode a selection of
connection strings, but I'd rather not (in case a new database is
created, etc.). I'd like to use the common dialog box which appears
when you navigate to Project Properties > Settings

Select Type=(Connection String), then click in the cell in the Value
column. A Connection Properties dialog opens up. If anyone knows how
to programmatically access this dialog box, I'd really appreciate it!
I've been looking all over the place for it!!!



*** Sent via Developersdex ***
Feb 15 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I built something in VS2003 that uses SQLDMO to get a list of servers
and then once authenticated on that server, a list of the databases
that are on that server and tables in the database. I do not know if
there is anything built into VS that will give you access to that

Make sure you have a reference to DMO in your project. Your network
security may also prevent this from working. This snipet below gets the
SQL servers on your network. If this works for you, i can post the rest
of the code, didnt want to clog up the thread if it isn't going to work
for you in VS2005!

Hope this helps or at least points you in a good direction!

Private Sub LoadSQLServers(Optional ByVal ObjToFill As Object =

Dim SQLDMO As New SQLDMO.Application
Dim List As SQLDMO.NameList
Dim SQLServerName As Object
Dim i As Integer
Dim SQLServers() As String


List = SQLDMO.ListAvailableSQLServers
Catch ex As Exception
MsgBox(Err.Number & vbCrLf & vbCrLf & Err.Description &
vbCrLf & vbCrLf)

MsgBox("Unable to generate list of available SQL Servers."
& vbCrLf & "Check your network connections " & _
"try again.", MsgBoxStyle.Critical + MsgBoxStyle.OKOnly,
"SQL Server Location Error")
Exit Sub
End Try

ReDim SQLServers(List.Count)

'ObjToFill is assumed to be a list type control

For Each SQLServerName In List : i += 1
SQLServers(i) = (List.Item(i))
If Not ObjToFill Is Nothing Then
End If

End Sub

Feb 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.