当前位置:文档之家› TDataSet

TDataSet

//Properties

property ActiveRecord: Integer read FActiveRecord; Indicates the index of the active record in the internal cache of records.
在记录缓存区的内部缓存中的激活记录的索引;

property CurrentRecord: Integer read FCurrentRecord; Indicates the index of the current record in the internal cache of record buffers.
在记录缓存区的内部缓存中的当前记录的索引;

property BlobFieldCount: Integer read FBlobFieldCount; Indicates the number of columns in the dataset that represent Binary large object (BLOB) fields.
显示BLOB(二进制大对象fields?)数据集的列数

property BookmarkSize: Integer read FBookmarkSize write FBookmarkSize; Indicates the number of bytes used to represent a bookmark.
显示书签的字节数

property Buffers: PByte read GetBuffer; Provides indexed access to the record buffers in the internal cache.
在内部缓存中提供索引来存取记录的缓冲区;

property BufferCount: Integer read FBufferCount; Indicates the number of records in the internal cache.
显示缓冲区的记录数量

property CalcBuffer: PByte read FCalcBuffer; Points to the record buffer used during an OnCalcFields event.
指向缓冲区OnCalcFields事件期间使用的记录

property CalcFieldsSize: Integer read FCalcFieldsSize; Indicates the number of bytes in a record buffer dedicated to storing calculated fields and lookup fields.
显示在记录缓冲区中用于存储,查找和计算fields的字节数

property Constraints: TCheckConstraints read FConstraints write SetConstraints; Specifies record-level constraints that must be met when editing the data.
指定编辑数据时必须满足的 记录级别? 约束。

property FieldNoOfs: Integer read FFieldNoOfs write FFieldNoOfs; Specifies the offset needed to convert indexes in the Fields property to field numbers.
指定 fields内数据 转换指针 所需偏移量

property InternalCalcFields: Boolean read FInternalCalcFields; Indicates whether the dataset includes internally calculated fields.
表明dataset是否包含在内部的字段

property NestedDataSets: TList read GetNestedDataSets; Lists all nested datasets.
列出所有嵌套的datasets

property NestedDataSetClass: TDataSetClass read FNestedDatasetClass write FNestedDatasetClass; Indicates the class type to use when creating nested datasets.
显示创建datasets时 class的类型

property Reserved: Pointer read FReserved write FReserved; For internal use only.
读写FReserved, 仅供内部使用。

property AggFields: TFields read FAggFields; Contains any aggregate fields.
显示包含的任何集合的字段

property Bof: Boolean read FBOF; Indicates whether the first record in the dataset is active.
判断第一条记录是否激活。(一般用于遍历条件判断)

property Bookmark: TBytes read GetBookmark write GotoBookmark; Specifies the current bookmark in the dataset.

设置一个书签

property CanModify: Boolean read GetCanModify; Indicates whether the dataset permits write access to data.
显示数据集是否允许写 访问数据

property DataSetField: TDataSetField read FDataSetField write SetDataSetField; Indicates the persistent TDataSetField object that owns a nested dataset.
显示持续化的TDataSetField对象拥有一个嵌套的数据集

property DataSource: TDataSource read GetDataSource; Represents the data source of another dataset that supplies values to the dataset.
表示其他提供值的数据集的数据源,其默认值为nil;

property DefaultFields: Boolean read FDefaultFields; Indicates whether a dataset's underlying field components are generated dynamically when the dataset is opened.
表示一个数据集的基本字段是否打开数据集时动态生成。

property Designer: TDataSetDesigner read FDesigner; Returns a pointer to the DataSet designer for the dataset.
返回一个指针指向 指定数据集的 designer。

property Eof: Boolean read FEOF; Indicates whether a dataset is positioned at the last record.
判断数据集是否指向最后一条记录(在以下状态下为true:1.打开一个空的数据集;2.调用Last方法;3.调用next方法但当前记录已经是最后一条记录;4.对空范围或记录调用SetRange方法);

property BlockReadSize: Integer read FBlockReadSize write SetBlockReadSize; Determines how many record buffers are read in each block.
确定在每一块中有多少记录缓冲被读取。

property FieldCount: Integer read GetFieldCount; Indicates the number of field components associated with the dataset.
显示与数据集相关联的字段的数量。

property FieldDefs: TFieldDefs read FFieldDefs write SetFieldDefs; Points to the list of field definitions for the dataset.
指向定义数据集的字段列表。

property FieldDefList: TFieldDefList read FFieldDefList; Points to the list of field definitions for the dataset.
指向定义数据集的字段列表。

property Fields: TFields read FFields; Lists all non-aggregate field components of the dataset.
列出dataset中所有没有集合的字段

property FieldList: TFieldList read FFieldList; Lists the field components of a dataset.
列出dataset中所有字段

property FieldValues: Variant read GetFieldValue write SetFieldValue; Provides access to the values for all fields in the active record for the dataset.
在数据集的活动记录中提供对所有字段的值的访问方法。

property Found: Boolean read GetFound; Indicates whether or not moving to a different record is successful.
移动到一个不同的记录上是否成功;

property IsUniDirectional: Boolean read FIsUniDirectional; Indicates whether the dataset is unidirectional.
显示dataset是否是单向的

property Modified: Boolean read FModified; Indicates whether the active record is modified.
活动

的记录是否可以修改;

property ObjectView: Boolean read FObjectView write SetObjectView; Specifies whether fields are stored hierarchically or flattened out in the Fields property.
设置字段属性:分层存储或者单层存储

property RecordCount: Integer read GetRecordCount; Indicates the total number of records associated with the dataset.
与数据集关联的记录条数;

property RecNo: Integer read GetRecNo write SetRecNo; Indicates the active record in the dataset.
返回在一个数据集中已活动的记录条数;

property RecordSize: Word read GetRecordSize; Indicates the size of a record in the dataset.
表示需要内部缓冲区的大小

property SparseArrays: Boolean read FSparseArrays write SetSparseArrays; Determines whether a unique TField object is created for each element of an array field.
确定是否 一个通用Tfield对象 为字段数组中的每一个元素 被创建

property State: TDataSetState read FState; Indicates the current operating mode of the dataset.
设定当前数据集的操作模式的状态(打开一个数据集,状态由dslnactive变成dsBrowse;编辑状态(dsEdit);插入状态(dsInsert);调用SetKey或SetRange(dsSetKey);Posting或canceling(由当前状态变为dsBrowse);Closing数据集(由当前状态变为dslnactive));

property Filter: string read FFilterText write SetFilterText; Specifies the text of the current filter for a dataset.
筛选条件(条件语句为sql)

property Filtered: Boolean read FFiltered write SetFiltered; Specifies whether or not filtering is active for a dataset.
筛选是否开启(开启后数据集将跟随条件发生变化)

property FilterOptions: TFilterOptions read FFilterOptions write SetFilterOptions; Specifies whether or not filtering is case insensitive, and whether or not partial comparisons are permitted when filtering records.
指定过滤是否不分大小写,部分比较是否允许当过滤记录。

property Active: Boolean read GetActive write SetActive; Specifies whether or not a dataset is open.
判断数据库是否打开

property AutoCalcFields: Boolean read FAutoCalcFields write FAutoCalcFields; Determines when the OnCalcFields event is triggered and when lookup field values are calculated.
决定何时OnCalcFields事件被触发 以及 何时查找字段的值被计算




//METHODS
function ActiveBuffer: PByte; Returns a pointer to the buffer for the active record.
返回一个指向活动记录缓存的指针。(经常与bookmark配合来记录活动记录缓存中bookmark的信息)

procedure Append; Adds a new, empty record to the end of the dataset.
添加一个新的、空的记录到这个数据集的末尾。

procedure AppendRecord(const Values: array of TVarRec); Adds a new, populated record to the end of the dataset and posts it.
添加一个新的、空的记录到数据集的末尾并自动post。

functio

n BookmarkValid(Bookmark: TBytes): Boolean; virtual; Indicates the validity of a specified bookmark.
指定书签的有效性

procedure Cancel; virtual; Cancels modifications to the active record if those changes are not yet posted.
如果活动的记录没有post,则可以取消活动的记录。但如果记录的状态不为(dsEdit or dsInsert),则方法无效。

procedure CheckBrowseMode; Automatically posts or cancels data changes when the active record changes.


procedure ClearFields; Clears the contents of all fields for the active record.
清空活动记录的所有字段的值。

procedure Close; Closes a dataset.
关闭一个数据集。

function ControlsDisabled: Boolean; Indicates whether data-aware controls update their display to reflect changes to the dataset.


function CompareBookmarks(Bookmark1: TBytes; Bookmark2: TBytes): Integer; virtual; Implements a virtual function to compare two bookmarks.
用虚方法来比较两个书签。

function CreateBlobStream(Field: TField; Mode: TBlobStreamMode): TStream; virtual; Provides the interface for a method that creates a blob stream for a Binary large object (BLOB) field in the dataset.


procedure CursorPosChanged; Marks the internal cursor position as invalid.


procedure Delete; Deletes the active record and positions the dataset on the next record.
删除一个活动记录并指针移动到DataSet对象的下一个记录。

procedure DisableControls; Disables data display in data-aware controls associated with the dataset.
利用数据控件显示与一个DataSet对象关联的禁用数据。

procedure Edit; Enables editing of data in the dataset.
DataSet对象进入编辑状态。

procedure EnableControls; Re-enables data display in data-aware controls associated with the dataset.


function FieldByName(const FieldName: string): TField; Finds a field based on its name.
根据字段的名称来访问(只用用来访问已存在的字段,否则会报EDatabaseError错误)。

function FindField(const FieldName: string): TField; Searches for a specified field in the dataset.
搜索指定DataSet的字段。(如果未找到,则返回nil)

function FindFirst: Boolean; Implements a virtual method for positioning the dataset on the first record, respecting any filters.
是否指定DataSet对象的第一条记录,返回bool类型。

function FindLast: Boolean; Implements a virtual method for positioning the dataset on the last record, respecting any filters.
是否指定DataSet对象的最后一条记录,返回bool类型。

function FindNext: Boolean; Implements a virtual method for positioning the dataset on the next record, respecting any filters.
判断指针是否定位到DataSet对象的下一个数据记录,返回bool类型。

function FindPrior: Boolean; Implements a virtual method for positioning the dataset on the previous record, respecting any filters.

断指针是否定位到DataSet对象的上一个数据记录,返回bool类型。

procedure First; Moves to the first record in the dataset.
移动到DataSet的第一条记录。调用该方法的目的是为了让DataSet的第一条记录设置为active。

procedure FreeBookmark(Bookmark: TBytes); virtual; Frees the resources allocated for a specified bookmark.
释放分配给指定标签的内存。

function GetBookmark: TBytes; virtual; Allocates a bookmark for the active record in the dataset.
为数据集的活动记录分配标签。

function GetCurrentRecord(Buffer: PByte): Boolean; virtual; Implements a virtual function to retrieve the current record in a buffer.
返回在缓存中的记录。(如返回false,则表示缓存区填充失败;如返回true,则缓存成功)

procedure GetDetailDataSets(List: TList); virtual; Fills a list with a dataset for every detail dataset that is not the value of a nested dataset field.
将不是嵌套的数据集填充到一个数据集列表中。

procedure GetDetailLinkFields(MasterFields: TList; DetailFields: TList); virtual; Introduces a method to list the field components that link this dataset as a detail of a master dataset.


function GetBlobFieldData(FieldNo: Integer; var Buffer: TBytes): Integer; virtual; Reads BLOB data into a buffer.


function GetFieldData(Field: TField; Buffer: Pointer): Boolean; overload; virtual; Retrieves the current value of a field into a buffer.
在缓存中检索当前字段的值。(返回bool值,如返回false,则表示值未被成功提取)

function GetFieldData(FieldNo: Integer; Buffer: Pointer): Boolean; overload; virtual; Retrieves the current value of a field into a buffer.


function GetFieldData(Field: TField; Buffer: Pointer; NativeFormat: Boolean): Boolean; overload; virtual; Retrieves the current value of a field into a buffer.


procedure GetFieldList(List: TList; const FieldNames: string); Retrieves a specified set of field objects into a list.


procedure GetFieldNames(List: TStrings); overload; virtual; Retrieves a list of names for all fields in a dataset.


procedure GetFieldNames(List: TWideStrings); overload; virtual; Retrieves a list of names for all fields in a dataset.


procedure GotoBookmark(Bookmark: TBytes); Implements a virtual method to position the dataset on the record to which a specified bookmark points.
定位到数据集活动记录被书签标记的位置上。

procedure Insert; Inserts a new, empty record in the dataset.
向数据集插入一个新的、空的记录。

procedure InsertRecord(const Values: array of TVarRec); Inserts a new, populated record to the dataset and posts it.
向数据集插入一个新的、空的记录并自动post。

function IsEmpty: Boolean; Indicates whether the dataset contains no records.
判断数据集是否为空。

function IsLinkedTo(DataSource: TDataSource): Boolean; Indicates w

hether a dataset is linked to a specified data source.
判断数据集是否通过DataSource连接。

function IsSequenced: Boolean; virtual; Indicates whether the underlying database table uses record numbers to indicate the order of records.


procedure Last; Moves to the last record in the dataset.
将指针移动到数据集的最后一条记录。

function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean; virtual; Implements a virtual method for searching a dataset for a specified record and making it the active record.


function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant; virtual; Implements a virtual method to retrieve field values from a record that matches specified search values.


function MoveBy(Distance: Integer): Integer; virtual; Moves to another record relative to the active record in the dataset.
从一个活动记录移动到另一个记录。

procedure Next; Moves to the next record in the dataset.
移动到下一条记录。

procedure Open; Opens the dataset.
打开数据集。

procedure Post; virtual; Implements a virtual method to write a modified record to the database or change log.
将已修改过的记录写入到数据库或日志中[ADO组件直接将数据提交到数据库服务器]。

procedure Prior; Moves to the previous record in the dataset.


procedure Refresh; Re-fetches data from the database to update a dataset's view of data.


procedure Resync(Mode: TResyncMode); virtual; Re-fetches the active record and the records that precede and follow it.


procedure SetFields(const Values: array of TVarRec); Sets the values for all fields in a record


function CopyFields(Source: TDataSet): Integer;


function Translate(Src: PAnsiChar; Dest: PAnsiChar; ToOem: Boolean): Integer; virtual; Implements a virtual procedure to copy a data string from a source to a destination, optionally performing character translation during the copy.


procedure UpdateCursorPos; Positions the cursor on the active record.


procedure UpdateRecord; Ensures that data-aware controls and detail datasets reflect record updates.


function UpdateStatus: TUpdateStatus; virtual; Reports the update status for the active record.


相关主题
文本预览
相关文档 最新文档