同问,比如查询“长城”,查询结果是“万里长城”,当然我数据里有“长城”“万里长城”,但我想查询“长城”就出来“长城”,输入“万里长城”就出来“万里长城”啊,求代码。我的代码是这样的:
Dim tbx As WinForm.TextBox = e.Form.Controls("txtfind")
Dim chk As WinForm.CheckBox = e.Form.Controls("模糊查找")
Dim str As String = tbx.value
Dim dr As DataRow
If chk.checked Then
dr = DataTables("表A").find("品种 like '%" & str & "%'")
dr = DataTables("表A").find("别名 like '%" & str & "%'")
Else
dr = DataTables("表A").find("品种 = '" & str & "'")
dr = DataTables("表A").find("品种 like '%" & str & "%'")
End If
If dr IsNot Nothing Then
Dim idx As Integer = Tables("表A").findrow(dr)
If idx >= 0 Then
Tables("表A").position = idx
End If
End If
我是菜鸟,求指导!非常感谢