DbTrans Function | |
Transfer records to an open database file.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION DbTrans(
wTarget,
aStruct,
cbForCondition,
cbWhileCondition,
nNext,
nRecord,
lRest
) AS LOGIC CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static bool DbTrans(
Usual wTarget = default,
Usual aStruct = default,
Usual cbForCondition = default,
Usual cbWhileCondition = default,
Usual nNext = default,
Usual nRecord = default,
Usual lRest = default
)
Request Example
View SourceParameters
- wTarget (Optional)
- Type: Usual
The work area number of the destination file. - aStruct (Optional)
- Type: Usual
An array containing field descriptions in the format returned by DBStruct().
This array contains the structure of the source file.
- cbForCondition (Optional)
- Type: Usual
A code block that defines a condition that each record within the scope must meet in order to be processed. - cbWhileCondition (Optional)
- 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 (Optional)
- Type: Usual
The number of records to process, starting at nRecord. Specify 0 to ignore this argument.
- nRecord (Optional)
- Type: Usual
A single record number to process. Specify 0 to ignore this argument. - lRest (Optional)
- Type: Usual
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 |
---|
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 |
---|
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:
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