I want to use multiple % in BindingSource.Filter

91 views Asked by At

I have thousands of data like

uPVC Elbow 2"-D

uPVC Elbow 6"-D

uPVC Elbow 8"-B

uPVC Elbow 10"-B

uPVC Elbow 4"-D

uPVC Elbow 12"-B

uPVC Elbow 5"-B

uPVC Elbow 3"-B

uPVC Elbow 2"-C

uPVC Elbow 4"-B

uPVC Elbow 6"-B

uPVC Elbow 20"-C

All these data are in a single column called - PName

I want the user to filter data by typing in a textbox

he will type (Elb 5) in the textbox and the data (uPVC Elbow 5"-B) will be filtered out

Code Example: ProductBindingSource.Filter = "PName Like '%" & Str1 & "%" & str2 & "%'"

In here PName is the column name and Str1 = 'Elb' And Str2 = '5'

After execution of the code there is an exception:

System.Data.EvaluateException: 'Error in Like operator: the string pattern '%Elb%5%' is invalid.

0

There are 0 answers