I am trying to help my user to select a SQL Server instance and a database from a ComboBox. I am already connecting to SQL Server using the following code:
Dim connectionString As String = "Server=DESKTOP-MTHFG8E\PEACRO;" & "Database=my_database;" & "User ID=my_user_id;" & "Password=my_password;"
Using connection As New SqlConnection(connectionString)
Try
connection.Open()
MsgBox("Connected successfully")
' Perform database operations here
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Using
I now want to enable the user to select the server / instance in a ComboBox, and the database in another ComboBox.