Advantage Database Server

AdsSetField / AdsSetFieldW

Advantage Client Engine

AdsSetField / AdsSetFieldW

Advantage Client Engine

This is the first topic This is the last topic  

AdsSetField / AdsSetFieldW

Advantage Client Engine

This is the first topic This is the last topic  

Stores the given data into the specified field

Syntax

UNSIGNED32

AdsSetField ( ADSHANDLE hObj,

             UNSIGNED8 *pucFldName,

             UNSIGNED8 *pucValue,

             UNSIGNED32 ulLen);

UNSIGNED32

AdsSetFieldW ( ADSHANDLE hObj,

             UNSIGNED8  *pucFldName,

             WCHAR      *pwcValue,

             UNSIGNED32 ulLen );

Parameters

hObj (I)

Handle of table, cursor, or index order.

pucFldName (I)

Name of field to set.

pucValue (I)

ANSI/OEM code page encoded data to store in field.

pwcValue (I)

UTF16 encoded Unicode data to store in field.

ulLen (I)

Length of data in the buffer. For AdsSetField, the length is the number of bytes. For AdsSetFieldW, the length is the number of UTF16 characters.

Special Return Codes

AE_DATA_TOO_LONG

The data given was too long to fit in the field.

AE_DATA_TRUNCATED

The data given was too long to fit in the field. The data was truncated to fit into the field.

AE_INVALID_MONTH

The month given is not valid. Valid months are 1-12.

AE_INVALID_DAY

The day given is not valid for the given month.

AE_UNICODE_CONVERSION

Unicode data cannot be converted into ANSI/OEM code page encoded string without loss.

Remarks

AdsSetField and AdsSetFieldW can be used to store logical, string, memo, numeric, date, short date, double, CurDouble, Money, integer, short integer, time, timestamp, image, binary, RowVersion, ModTime, and raw data.

Dates, times, timestamps, and numerics, and Money values are expected to be given as text strings. Dates are expected to be formatted the same as the current AdsSetDateFormat setting. For example, to set a timestamp field, the value could be "7/28/1996 14:30:25". To set empty or null values in fields, use AdsSetEmpty. Setting the value of a field requires a data lock on the table, either a record lock or a file lock. If no lock is held on the current record or table, the Advantage Client Engine will attempt to get an implicit lock on the record. Implicit locks are released when the record is updated on the server.

If the handle passed is an index order handle, the logical record buffer of the index order is modified instead of the table data. The logical record buffer of the index order can be used to build a raw index key in conjunction with calls to AdsInitRawKey and AdsBuildRawKey.

The pucFldName parameter can be passed as the field name itself or as the one-based integer field position. To pass an integer field position for the pucFldName parameter, use the ADSFIELD macro that is defined in ACE.H. For example, to specify the first field in the table, pass ADSFIELD(1) for the pucFldName parameter; to specify the second field in the table, pass ADSFIELD(2) for the pucFldName parameter; etc.

Example

Click Here

 

See Also

AdsGetField

AdsGetFieldW

AdsGetFieldName

AdsSetLogical

AdsSetDate

AdsSetDouble

AdsSetEmpty

AdsSetJulian

AdsSetLong

AdsSetString

AdsSetStringW

AdsInitRawKey

AdsBuildRawKey

AdsSetLongLong

AdsSetMoney