对DBGrid的数据进行排序和过滤
2006-03-19 16:52
453 查看
这个是显示数据常用的操作,按道理看看CB的帮助就很容易找到答案,可是还有很多的人利用构造新的SQL重新检索的方法实现,实在是非~常~的不理解,利用ADO控件的Sort、Filter或者ClientDataSet的index、filter可以很容易在本地实现且效率很高的处理方式为什么不留意呐。
附CB帮助的内容:
过滤的:
//State = 'CA' OR State = 'MA'
ADODataSet1->Filtered = false;
ADODataSet1->Filter = "State = " + QuotedStr("CA") + " OR " + "State = " + QuotedStr("CA");
ADODataSet1->Filtered = true;
When a filter is set, Blank records do not appear unless explicitly included in the filter. To include rows based on blank, (or "NULL") values in table columns, compare the column to NULL in the expression. For example:
ADODataSet1->Filtered = false;
ADODataSet1->Filter = "State = " + QuotedStr("CA") + " OR " + "State = NULL";
ADODataSet1->Filtered = true;
排序的
ADOQuery1->Sort = "LastName ASC, DateDue DESC"
Read Sort to determine the field (or fields) on which the recordset is sorted.
附CB帮助的内容:
过滤的:
//State = 'CA' OR State = 'MA'
ADODataSet1->Filtered = false;
ADODataSet1->Filter = "State = " + QuotedStr("CA") + " OR " + "State = " + QuotedStr("CA");
ADODataSet1->Filtered = true;
When a filter is set, Blank records do not appear unless explicitly included in the filter. To include rows based on blank, (or "NULL") values in table columns, compare the column to NULL in the expression. For example:
ADODataSet1->Filtered = false;
ADODataSet1->Filter = "State = " + QuotedStr("CA") + " OR " + "State = NULL";
ADODataSet1->Filtered = true;
排序的
ADOQuery1->Sort = "LastName ASC, DateDue DESC"
Read Sort to determine the field (or fields) on which the recordset is sorted.
相关文章推荐
- 【EntityFramework系列教程三,翻译】在ASP.NET MVC程序中使用EntityFramework对数据进行排序、过滤筛选以及实现分页
- gridview利用 DataView 对象进行排序和过滤数据
- 安卓学习笔记(2)- SQLite中使用query函数对某类数据进行排序
- 扒扒数据库长长知识(下载资源组合看)之 03 (过滤和排序数据)
- SQL数据进行排序、分组、统计10技巧
- 对于一系列数据通过单击进行排序(每次只能单击一次)
- 根据首字母的排列顺序对一组数据进行排序
- asp.net中对DataTable数据进行排序、检索、合并、分页、统计
- 在datagrid里面生成指定的DataView ,进行过滤.把符合条件的数据显示出来
- Oracle排序过滤重复数据,取最新的数据
- MapReduce按照两个字段对数据进行排序
- Oracle DB对数据进行限制和排序
- [ios]NSArray中的数据进行排序 ---- sortedArrayUsingDescriptors
- PHP中使用Filter进行数据安全过滤
- 用同一个函数名对n个数据进行从小到大排序 用函数模板
- 用于对获取的DataTable的数据进行筛选,排序等操作
- iOS 对NSMutableArray进行排序和过滤的实例
- SQL SERVER 取出 一张表中的每个分组中 的第一条数据 ,第一条数据是按照某种排序规则进行排序取的第一条
- 对json数据进行排序和搜索
- 数据窗口单击标题栏自动进行排序,并显示升降序/拖动行可以改变行顺序