I have an access database and connected to vb.net through oledb. Am trying to filter the datagridview based on the combobox selection in the form. The combobox(emp id) is being loaded from the table called Employee. When the user selects an employee id from the combox i want the relevant records of the employee from the other called DATA to be displayed. I tried many methods but couldnot get the result. Can someone help on this please.
Form name-Form1
Combobox data-From Table Employee
Datagridview- Datagridview1
Datagrid Source-From table Data


Recommended Answers

All 2 Replies


How are you populating the DataGrid? If it is standard OleDb with a DataTable then you can simply issue a new query against the database using the WHERE criteria to filter returned data for the selected employee ID, populate a new DataTable and then bind that DataTable to the DataGrid.

Alternatively, you can issue SELECT statements against a DataTable to filter for data that you want or use a DataView.

If you show us the code that you currently have, it would be easier to then offer a suitable solution.

hi, thanks for the reply. Will try with your suggestion with WHERE criteria and make an attempt.

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.