|
![]() |
#1 |
MCTS
|
Цитата:
Remarks
The method will fall back to record-by-record insert, if (a) the table is not SQL stored, (b) the insert() method is overloaded, or (c) the tables includes memo- or container-fields. Also, a RecordSortedList must be server-located before insertDatabase() can be called, otherwise an exception is thrown. Example Below is an example of how to insert N, or in this case 3, records in one, single database operation. X++: { RecordSortedList recordSortedList; CustTable custTable; ; recordSortedList = new RecordSortedList(tablenum(CustTable)); recordSortedList.sortOrder(fieldnum(custTable,AccountNum)); ttsbegin; custTable.AccountNum = '1000'; // prepare record #1 for insertion custTable.CreditMax = 10000.0; recordSortedList.ins(custTable); custTable.AccountNum = '2000'; // prepare record #2 for insertion custTable.CreditMax = 500.0; recordSortedList.ins(custTable); custTable.AccountNum = 'N000'; // prepare record #N for insertion custTable.CreditMax = 9999999.9; recordSortedList.ins(custTable); recordSortedList.insertDatabase(); // all N records are inserted in one database operation ttscommit; } |
|