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