如何在datagridveiw中找到完全匹配 [英] How to find the exact match in datagridveiw
问题描述
大家好,
能够使用以下代码过滤文本框更改事件中的数据。
但我如何与此完全匹配。例如,如果我输入25,数据显示哪个匹配25,以及255,25555555那样..我想当我输入25只有25的数据应该反映。 (对不起,如果你对我的问题感到困惑)
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)
Me.CopydetailsBindingSource.Filter = "Branch_Code Like" & "'" & TextBox1.Text & "%" & "'"
我尝试过:
Me.CopydetailsBindingSource.Filter =Branch_Code Like& '& TextBox1.Text& %& '
What I have tried:
Me.CopydetailsBindingSource.Filter = "Branch_Code Like" & "'" & TextBox1.Text & "%" & "'"
推荐答案
Me.CopydetailsBindingSource.Filter = "Branch_Code ='" & TextBox1.Text & "'"
如评论中所述,此代码容易受到SQL注入攻击。
As mentioned in the comments, this code is susceptible to sql injection attacks.
这篇关于如何在datagridveiw中找到完全匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!