Data.DB.TDataSet.SetFields

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure SetFields(const Values: array of const);

C++

void __fastcall SetFields(const System::TVarRec *Values, const System::NativeInt Values_High);

Properties

Type Visibility Source Unit Parent
procedure
function
public
Data.DB.pas
Data.DB.hpp
Data.DB TDataSet

Description

Sets the values for all fields in a record

Call SetFields to set values for some or all fields in the active record at the same time.

Values contains the values to insert into each field. Values are assigned to the record based on the order of columns in the table or tables underlying the dataset. These values can be literals, variables, NULL, or nil (Delphi). If Values contains fewer values than there are fields in the record, all records for which values are not provided are assigned a NULL value. A NULL value overwrites any existing value in such fields.

In C++, Values_Size is the index of the last value in the Values array (one less than the total number of values).

Before calling SetFields, call Edit to put the dataset into dsEdit state. After calling SetFields, call Post to write the changes to the database or change log.

Note: To set values for some fields while retaining existing values for others, pass nil (Delphi) or NULL (C++) (explicitly casting it to void * in C++) for each field that should not change.

See Also