Click here to Skip to main content
15,991,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

am able to filter the data in the textbox change event with below code.

but how do i make exact match for this. for example if i enter 25 the data is showing which is matching 25 , as well 255 , 2555555 like that.. i want when i enter 25 only 25's data should reflect. (sorry if you are confused about my questions)

C#
Me.CopydetailsBindingSource.Filter = "Branch_Code Like" & "'" & TextBox1.Text & "%" & "'"


What I have tried:

Me.CopydetailsBindingSource.Filter = "Branch_Code Like" & "'" & TextBox1.Text & "%" & "'"
Posted
Updated 13-Jul-16 3:43am
Comments
Herman<T>.Instance 13-Jul-16 9:35am    
Don't do LIKE but = and no % sign:
e.CopydetailsBindingSource.Filter = "Branch_Code - '" & TextBox1.Text & "'"

(BEWARE of SQLINJECTION with this type of querying)

1 solution

C#
Me.CopydetailsBindingSource.Filter = "Branch_Code ='" & TextBox1.Text & "'"


As mentioned in the comments, this code is susceptible to sql injection attacks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900