Hello,

Please help! I"ve created a form with three comboboxes and a datagrid. I've connect the comboboxes to the database and they all work but when i try and fill the datagrid based on the final selection from the last commbobox but it will not populate the datagridview..Help!

cmbVendor_MouseClick
Dim drv As DataRowView = cmbNatureCode.SelectedItem
Dim drv1 As DataRowView = cmbPort.SelectedItem
Dim drv2 As DataRowView = cmbVendor.SelectedItem
Dim port As String = drv1.Item("natureport").ToString
Dim ncode As String = drv.Item("naturecode").ToString
Dim vendor As String = drv2.Item("vendor").ToString
Dim da As New SqlDataAdapter("SELECT * FROM rates WHERE natureport = '" & port & "' and naturecode = '" & ncode & "' and naturecode = '" & vendor & "' ORDER BY vendor", conn)
Dim ds As New DataSet

da.Fill(ds, "rates")
ratesdataview.DataSource = ds.DefaultViewManager
conn.Close()

Maybe you can share the codes in the combobox selected function?

Thank you, I figured it out it was my query...duh! "naturecode = '" & vendor & "' " it should have vendor = vendor!

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.