ClientDataset摘录
Field,Fields,FieldDef,FieldDefs,FieldDefList区别
http://www.cnblogs.com/del/archive/2010/01/27/1657349.html
1、Fields 是 Field 的集合, 它们主要用于运行时对字段元数据和字段值的访问.
2、FieldDefs 是 FieldDef 的集合, 它们主要用于构建数据集(表)和对字段元数据的访问.
3、FieldList 和 FieldDefList 分别是访问 Field 和 FieldDef 的快捷列表; 主要使用其 FieldByName、Find 方法和默认的数组属性访问数据; 它们是只读的.
4、通过 Fields、FieldList、Field 可以得到更多信息, 但必须是在数据集打开的情况下;
通过 FieldDefs、FieldDefList、FieldDef 只能获取定义时的信息, 但即使在数据集关闭时也能使用.
5、顾名思义 FieldDef 是用于定义表的, 但通过 Field 也可以定义表;
用 FieldDef 定义表很方便, 用 Field 可以定义一些更复杂的表;
每个 FieldDef 都会对应一个 Field, 但一个 Field 不一定有 FieldDef 对应;
程序运行后 FieldDef 不能再改变, 而 Field 与 Fields 则可以动态改变或增减.
ClientDataset排序
http://www.cnblogs.com/del/archive/2010/01/28/1658118.html
AddIndex(
const Name: string; { 索引名称; 不能重名 }
const Fields: string; { 索引字段; 多个字段用分号隔开; 默认升序排列 }
Options: TIndexOptions; { 选项 }
const DescFields, { 按降序排列的字段; 须先在 Fields 中列出 }
const CaseInsFields: string; { 不区分大小写的字段; 须先在 Fields 中列出 }
const GroupingLevel: Integer { 分组级别, 用于分组统计的 }
);
//Options:
IxPrimary { 主索引 }
IxUnique { 字段值无重复 }
ixDescending { 降序 }
ixCaseInsensitive { 不区分大小写 }
ixExpression { 无用 }
ixNonMaintained { 无用 }
//F1、F2 降序, 两种写法一样:
AddIndex('Index_1', 'F1; F2', [ixDescending]);
AddIndex('Index_2', 'F1; F2', [], 'F1; F2');
//F1、F2 不区分大小写排序(不指定降序则默认升序):
AddIndex('Index_1', 'F1; F2', [ixCaseInsensitive]);
AddIndex('Index_2', 'F1; F2', [], '', 'F1; F2');
//F1 升序, F2 降序:
AddIndex('Index_1', 'F1; F2', [], 'F2');
AddIndex('Index_2', 'F1; F2', [ixDescending], 'F2'); { 此时 [ixDescending] 被忽略 }
//F1 降序, F2 升序:
AddIndex('Index_1', 'F1; F2', [], 'F1');
AddIndex('Index_2', 'F1; F2', [ixDescending], 'F1');

浙公网安备 33010602011771号