+ 1
How can I filter a BindingSurce with a variable?
How can I do this: source1.Filter = "artist = 'Dave Matthews' OR cd = 'Tigerlily'"; But artist should be like a variable that I previously declared. source1.Filter = "artist = '' '' + variable; ???
1 Respuesta
+ 1
Yes you can
But Filter is a ordinairy string not a sql statement.
So you have to do it with string concatenate.
FilterString = "artist = " + "'" + Name + "'" + " OR " + "cd = " + "'" + cd + "'" ;
" ' " (notice that those rows of five quotes is one single quote embbedded in a double quotes)
https://code.sololearn.com/cqwiN3itrnP8