且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

桌面应用程序的搜索功能代码

更新时间:2023-10-19 17:07:16

使用搜索字符串进行过滤,
如果我在其中输入搜索字符串的文本框即(txtName)
& datagrid中的数据字段名称为dgName,然后

将字符串创建为"dgName like""+ trim(txtName.text)+"%"
然后使用Datagrid中的数据源创建一个数据视图
使用dataview.rowfilter命令&将创建的字符串传递给此
然后再次将相同的数据视图绑定到网格
use search string for filtering,
if I have text-box namely (txtName) where I am entering my search string
& datafield name in datagrid is dgName then

create string as " dgName like '' " + trim(txtName.text) + " %''"
then create a dataview with data source from Datagrid
use dataview.rowfilter command & pass created string to this
then again bind same dataview to grid