-1
即時嘗試從兩個不同的數據庫表填充2 ComboBox
es,但我的代碼似乎不工作,我應該在這裏做什麼?如何在VB.NET中使用不同數據庫表填充兩個組合框
代碼:
Dim st As String = "server=localhost;user id=root;database=db;password=root"
Dim con As New MySqlConnection(st)
con.Open()
Dim se As String = "select * FROM tbl1 as t1, tbl2 as t2 WHERE t1.col=t2.col"
Dim cmd As New MySqlCommand(se, con)
Dim dr As MySqlDataReader = cmd.ExecuteReader()
While dr.Read()
ComboBox1.Items.Add(dr("col1"))
ComboBox2.Items.Add(dr("col1"))
End While
con.Close()
這是一個教訓,謝謝! – 2014-10-18 15:09:15