Combo box and select query

mulefeathers

Newcomer
Joined
Sep 4, 2004
Messages
1
I have a basic windows form in VB. I am using the following code to connect to a SQL database. The database has two tables. The goal here is have a user make a selection in one combo box and populate the other with only the records that match the query. The first combobox is populated by table tblsymbols column process. The second is populated by tblparts and should fill the box with all part numbers where the process columns match.

Private Sub frmParts_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.TblPartsTableAdapter.Fill(Me.KanbanDataSet.tblParts)

Me.TblSymbolsTableAdapter.Fill(Me.KanbanDataSet.tblSymbols)
Dim sqlprocess As String = Nothing
sqlprocess = "SELECT * from tblSymbols"
cboprocess.DataSource = KanbanDataSet.Tables(1)
cboprocess.ValueMember = "Process"
cboprocess.SelectedValue = -1


End Sub

Private Sub ProcessComboBox_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboprocess.SelectedIndexChanged

Dim strprocess As String = cboprocess.Text
Dim strpart = "SELECT PartNumber FROM tblParts WHERE Process = strprocess"

End Sub

Any help would be great.
 
Back
Top