Dim DBconn As New SqlConnection("Server=localhost;Trusted_Connection=True")
Dim DBsearch As New SqlDataAdapter("select * from sys.databases", DBconn)
Dim DBset As New DataSet
DBconn.Open()
DBsearch.Fill(DBset, "sys.databases")
SelectDB.DataSource = DBset.Tables("sys.databases")
SelectDB.DisplayMember = "name"
DBconn.Close()
Dim objConn As New SqlConnection _("Server=localhost;Trusted_Connection=True;database=SelectDB.SelectedItem")
objConn.Open()
Dim objLiteral As System.Text.StringBuilder = New System.Text.StringBuilder()
Dim newTable As String = Form1.addTable.Text.Trim()
แล้วเจอ error แบบนี้ครับ
Cannot open database "SelectDB.SelectedItem" requested by the login. The login failed.
Login failed for user 'My User'