Click or drag to resize

VoDbTrans Function

X#
Transfer records to an open database file.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION VoDbTrans(
	wTarget AS DWORD,
	fldNames AS _FieldNames,
	cbForCondition AS USUAL,
	cbWhileCondition AS USUAL,
	nNext AS USUAL,
	nRecord AS USUAL,
	lRest AS LOGIC
) AS LOGIC
Request Example View Source

Parameters

wTarget
Type: DWord
The work area number of the destination file.
fldNames
Type: _FieldNames
List of field names to copy
cbForCondition
Type: Usual
A code block that defines a condition that each record within the scope must meet in order to be processed.
cbWhileCondition
Type: Usual
A code block that defines another condition that each record must meet in order to be processed. As soon as a record is encountered that causes the condition to fail, the operation terminates.
If no scope is specified, cbWhileCondition changes the default scope to lRest.
You define the scope using one of these three, mutually exclusive arguments.
The default is all records.
nNext
Type: Usual
The number of records to process, starting at nRecord. Specify 0 to ignore this argument.
nRecord
Type: Usual
A single record number to process. Specify 0 to ignore this argument.
lRest
Type: Logic
TRUE processes only records from nStart to the end of the file. FALSE processes all records.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
Tip Tip
The nNext, nRecord, and lRest arguments are mutually exclusive. You should not pass all three of them. And if you pass the cbWhile argument then this also controls the scope behavior.
DBTrans() copies records from one work area to another open database file. By default, this function operates on the currently selected work area.
It can be made to operate on an unselected work area by specifying it within an aliased expression
Tip Tip
Deleted source records: If SetDeleted() is FALSE, records are copied; however, the deleted records do not retain their deleted status. No record is marked for deletion in the target file regardless of its status in the source file If SetDeleted() is TRUE, deleted records are not copied to the target database file. Similarly, filtered records are ignored during a copy and are not included in the target file.
Examples
The following example appends the contents of file TESTFROM.DBF to TESTTO.DBF:
X#
 1USE testto
 2IF !Used()
 3    ? "Error opening TESTTO.DBF"
 4ELSE
 5    siTo := VODBGetSelect()
 6    USE testfrom NEW
 7    IF !Used()
 8        ? "Error opening TESTFROM.DBF"
 9    ELSE
10        siFrom := VODBGetSelect()
11        aStruct := DBStruct()
12        DBTrans(siTo, aStruct)
13        CLOSE
14        DBSetSelect(siTo)
15    ENDIF
16    CLOSE
17ENDIF
See Also