complex sql in TableNameBindingSource.Filter

Ultrawhack

Well-known member
Joined
Jul 5, 2006
Messages
164
Location
Canada
Programming Experience
3-5
With ref to Paszt's code http://www.vbdotnetforums.com/showthread.php?t=11626

Can someone please help me on adding complex sql to the TableNameBindingSource.Filter ?

I would like user to be able to use the txtQuickSearch's KeyUp as a master search to look for anything in datagridview1 including :
text, memo, date & integer fields whose fields can be [Name], [Info], [Emp ID], [Join date]

The sql would be a complex combination of LIKE... OR.... =... #

I hope I've been able to exlain this clearly but for the life of me I cannot draw up the sql.

Thanks for any help
 
Special Characters
1. How would I correctly handle user entry, say "Frankie's" into the search string ? "Frankie's gone to Hollywood" does exist in the database. I'd like to allow standard special characters into the search string. Right now my filter code fails when a special character is used.

Multi-select
2. Once my DGV is filtered, is there a way to select all the results and copy to an unbound dgv using a cmdbutton ?

3. Although my DGV is set to multiselect=false and fullrowselect, once the DGV is filtered, is there any way to allow shift/ctrl to allow multiselect

Thanks for any help
 
Last edited:
To Filter datagridview you could just use the string.Replace to replace single apostrophes with double ones ->
dataGridView.Filter = "Country = '" & textBox1.Text().Replace("'","''") & "'"



This will take care of Frankie's house
 
Multi-select
2. Once my DGV is filtered, is there a way to select all the results and copy to an unbound dgv using a cmdbutton ?

DGV dont contain any data, they jsut show you the contents of a data container. You need to have a look in the relevant datatable for the data you require. If you assign it to another dgv then the other one will also show the data you require..

3. Although my DGV is set to multiselect=false and fullrowselect, once the DGV is filtered, is there any way to allow shift/ctrl to allow multiselect
set it to multiselect = true
 
Back
Top