我无法弄清楚我的问题没有错误但是组合框中的值没有从 mysqldatabase 显示这里是我的代码
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim conn As New MySqlConnection
conn.ConnectionString = "server=localhost;user vbid=root;password=admin;database=dnidb"
Dim reader As MySqlDataReader
Try
conn.Open()
Dim query As String
query = "select * from dnidb.hargapro where NamaP = '" & ComboBox1.Text & "'"
command = New MySqlCommand(query, conn)
reader = command.ExecuteReader
While reader.Read
TextBox8.Text = reader.GetInt32("HargaP")
End While
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Dispose()
End Try
End Sub
这段代码没有错误,但没有在组合框中显示任何内容,我尝试在组合框_selectedindexchanges上制作这个圆锥体,而组合框中没有显示同样的内容
我没有看到任何尝试将产品名称检索到组合框的代码,而且上面的代码似乎应该在组合框的 SelectedIndexChanged 事件上。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句