我正在尝试帮助我的用户从组合框中选择 SQL Server 实例和数据库。我已经使用以下代码连接到 SQL Server
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
我现在想让用户在组合框中选择服务器/实例,并在另一个组合框中选择数据库。