Hi
I am using the code below to get a list of available SQL Servers & Instances in a VB.NET Winforms application running on version 3.5 of the .Net framework.
Me.Cursor = Cursors.WaitCursor
Me.Label_SQLserver.Text = "Searching..."
Dim dtTest As New DataTable
dtTest = Sql.SqlDataSourceEnumerato
r.Instance
.GetDataSo
urces
Dim row As DataRow
For Each row In dtTest.Rows
ComboBox1.Items.Add(row("S
erverName"
) & "\" & row("InstanceName")) ' Seeking Result: ServerName\InstanceName
Next
ComboBox1.DroppedDown = True
Me.Label_SQLserver.Text = ""
Me.Cursor = Cursors.Default
The above works great but what I want to do now is using the "ServerName\InstanceName" along with "username" and "password" credentials to fill a combobox with Databases available on that SQL server.
The end result I wish to achieve with the above is to use this winform to build a SQL Connection String.
Thanks for your help in advance.
Matthew
Start Free Trial