Click or drag to resize

DbServer.FieldPut Method (Typed)

X#
Set the value of a field identified by its position.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD FieldPut(
	uField AS USUAL,
	uValue AS USUAL
) AS USUAL
Request Example View Source

Parameters

uField
Type: Usual
The name, number, or symbol representing the desired field.
uValue
Type: Usual
The value to assign to the field. The data type of this expression must match the data type of the field.

Return Value

Type: Usual
The value assigned to the field. If nFieldPos does not correspond to the position of any field in the data server, DBServer:FieldPut() returns NIL.
Remarks
DBServer:FieldPut() allows you to set the value of a field using its position within the database file structure rather than its field name. Within generic database service functions this allows, among other things, the setting of field values without use of the macro operator.
Tip Tip
DBServer:FieldPut() can be used with a BLOB field (that is, a memo field associated with a BLOB file), provided the length of the field does not exceed 64KB.
Shared mode: For a shared database, this function requires a record lock. Refer to the "Concurrency Control" chapter in the Programmer's Guide for more information on locking.
Examples
This example compares DBServer:FieldPut() to functionally equivalent code that uses the macro operator to set the value of a field:
X#
1LOCAL nFieldPos := 1, FName, FVal
2LOCAL oDBCust := Customer{} AS DBServer
3// Set field value using macro operator
4FName := oDBCust:FieldName(nFieldPos)
5oDBCust:&FName := FVal
6// Set field value using FieldPut() samples:
7oDBCust:FieldPut(nFieldPos, FVal)
8oDBCust:FieldPut( #SSN, SELF:oDCsleSSN:Value )
9oDBCust:FieldPut( "SSN", SELF:cSSN )
See Also