Partilhar via


RecordInsertList.insertDatabase Method

Definition

Inserts all records that have not already been inserted into the current RecordInsertList object.

public:
 virtual int insertDatabase();
public virtual int insertDatabase ();
abstract member insertDatabase : unit -> int
override this.insertDatabase : unit -> int
Public Overridable Function insertDatabase () As Integer

Returns

An integer that represents the total number of records that were inserted.

Remarks

The RecordInsertList.add method flushes records to the database whenever this will speed up performance.

The following example uses the RecordInsertList class to copy a BOM from one BOM to another. The RecordInsertList.add method is used to add all the records in the BOM to the RecordInsertList class before a final call is made to the insertDatabase method to insert all remaining records.

void copyBOM(BOMId _FromBOM, BOMId _ToBOM) 
{ 
    RecordInsertList BOMList; 
    BOM BOM, newBOM; 
    BOMList = new RecordInsertList(tableNum(BOM)); 
    while select BOM 
    where BOM.BOMId == _FromBOM 
    { 
        newBOM.data(BOM); 
        newBOM.BOMId = _ToBOM; 
        BOMList.add(newBOM); 
    } 
    BOMList.insertDatabase(); 
}

Applies to