Dataset question (newbie)

shannanl

New member
Joined
Dec 28, 2005
Messages
2
I am new to ado.net. I have a dataset that I am using to populate a datagridview. Under the grid I have a text box and I want the user to be able to filter the datagrid based on what they type in the box. As an example, if the user types an "A" then all people listed in the grid with the last name of "A" will show up. If they type "AB", only people starting with "AB" will show up. I use the WHERE LIKE " & textbox1.text & "% as my query. I dont want to have to requery the db each time. I understand that this can be done with the dataset but I dont know how. Any help would be greatly appreciated.

Shannan
 
The DataGridView has a Filter parameter that you can use many SQL filtering statements. like "Name = a"

or as you would do it using VB.net (C# uses a plus sign instead of amperstand):

dgv.filter = "Name " & textbox.text & ""
dgv.refresh

or something very similar to that.

Lookup the Filter method in MSDN and they have an example of how it works.
 
Back
Top