Multiple ComboBox pulling from DB and Displaying to DataGrid

How do I tie multiple comboBoxes together with a database/query? I can fill my DataGrid with the selected department in my deptBox with :

 Access.ExecQuery("SELECT * FROM Master WHERE Department= '" & deptBox.SelectedItem & "'") dgvBooks.DataSource = Access.DBDT 

But I also want it to go 2 more levels. Meaning if they select a course, only populate with those Dept/Course values that match and then with a section if a section is selected in its combBox. How would I do this? This code doesn’t work :

Access.ExecQuery("SELECT * FROM Master WHERE Department= '" & deptBox.SelectedItem & "' And Course = '" & courseBox.SelectedItem & "' And Section = '" & sectionBox.SelectedItem & "'") dgvBooks.DataSource = Access.DBDT 

submitted by /u/bbean_16
[link] [comments]

Leave a Reply