Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Filter an Access Database to a DataGridView
 

Filter an Access Database to a DataGridView

Can someone help me please!

I am trying to filter a database so a user only see's the required records based on 4 selections. Now I have managed to do it by binding the controls and setting the filter on the bindingsource, however I have been reading that this is not good in a large database as the dataset is loaded into the memory. So now I have been trying to set it up by changing the fill query on the table adapter, will this work? And if so how do I do it?
I have a dialog box that comes up and I want to be able to select from 4 combo boxes that get thier displayed values from the data and then filter that data to display matching results only.

I am using VB2005 and have a datagrid view and getting data from an access database.
Thanks in advance.

Arg.
Arguillon  Sunday, February 01, 2009 6:25 PM
Hi!!!

You are right that the Dataset resides in the memory. Your idea to fill it by a conditional query is good.

What I have understood from ur problem is it that you have a datagridview binded with a datatable. You want to fill it with a conditional query based on the values from the 4 comboboxes which are on a dialog box.

Now ....

1) Load the dialog box.
2) Fill your comboboxes.
3) Select return values from the Comboboxes to variables.
4) Create a SelectCommand with the returned values.
5) Execute the command and fill your datatable.
6) Bind your DataGridView with the returned Values.....

That's it..

Further if any query submit it please.

Keep Coding..............


Nothing is Impossible.....
R.KUMAR  Thursday, August 20, 2009 1:47 PM

You can use google to search for other answers

Custom Search

More Threads

• Databound combobox
• DataBound DataGridView Relational DB Problem
• BindingList with multiple filtered views
• DataGridView, KeyDown Event
• Datagridview TextBox column values not displaying properly - VB.Net - Windows Application
• Populating a datagrid from two tables in a dataset
• Binding a collection of textboxes in a FlowLayoutPanel to a table row(s)
• DataGridView Row with a line underneath.
• Datagridview
• How to Access SQLServer Express Database using ADODB?