Показать сообщение отдельно
Старый 03.12.2008, 12:03   #10  
Eldar9x is offline
Eldar9x
MCTS
Аватар для Eldar9x
Oracle
MCBMSS
 
1,064 / 166 (8) ++++++
Регистрация: 29.09.2006
Адрес: Казань
Цитата:
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;
}