RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TField.SetData Method

Assigns unformatted data to the field.

Pascal
procedure SetData(Buffer: Pointer; NativeFormat: Boolean = True); overload;
C++
__fastcall SetData(void * Buffer, Boolean NativeFormat = True);

Use SetData to assign data to a field in the format that is used by the underlying database table. Ultimately, any method of setting the data for the field component calls SetData, once the data has been parsed into the format expected by the database table. 

SetData calls the OnValidate event handler before writing the data to the current record buffer. If the data is successfully written, SetData calls the OnChange event handler. 

Buffer contains the field value in the field components underlying type. NativeFormat indicates whether the value in Buffer must be translated before the dataset assigns its value to its internal record.

Note: SetData cannot be used to assign data to BLOB or memo fields. To write BLOB data, use the stream returned by the dataset's CreateBlobStream method or the BLOB field's LoadFromStream method.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!