+ 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; ???

16th Apr 2019, 3:01 PM
Abraham Querido
Abraham Querido - avatar
1 Antwort
+ 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
16th Apr 2019, 8:20 PM
sneeze
sneeze - avatar