Share via


RecordSortedList.insertDatabase Method

Definition

Overloads

insertDatabase()

Inserts multiple records on a single trip to the database.

insertDatabase(Connection)

insertDatabase()

Inserts multiple records on a single trip to the database.

public:
 virtual void insertDatabase();
public virtual void insertDatabase ();
abstract member insertDatabase : unit -> unit
override this.insertDatabase : unit -> unit
Public Overridable Sub insertDatabase ()

Remarks

After the call, the list entries remain in the RecordSortedList object. The RecordSortedList class must be located on the server before the insertDatabase method is called; otherwise, an exception is thrown. RecIds and other system-maintained fields are not assigned values until the insertDatabase method call is made. The method reverts to a record by record insert if any of the following conditions are met:

  • The table is not SQL-stored.
  • The insert method for the table is overloaded.
  • The table includes memo or container fields.

The following example shows how to insert three records in a single database operation.

{ 
    RecordSortedList recordSortedList; 
    CustTable        custTable; 
    recordSortedList = new RecordSortedList(tablenum(CustTable)); 
    recordSortedList.sortOrder(fieldnum(custTable,AccountNum)); 
    ttsbegin; 
    // Prepare record #1 for insertion. 
    custTable.AccountNum = '1000'; 
    custTable.CreditMax = 10000.0; 
    recordSortedList.ins(custTable); 
    // Prepare record #2 for insertion. 
    custTable.AccountNum = '2000'; 
    custTable.CreditMax = 500.0; 
    recordSortedList.ins(custTable); 
    // Prepare record #3 for insertion. 
    custTable.AccountNum = '3000'; 
    custTable.CreditMax = 9999999.9; 
    recordSortedList.ins(custTable); 
    // All three records inserted in one database operation. 
    recordSortedList.insertDatabase();   
    ttscommit; 
}

Applies to

insertDatabase(Connection)

public:
 virtual void insertDatabase(Dynamics::AX::Application::Connection ^ _connection);
public virtual void insertDatabase (Dynamics.AX.Application.Connection _connection);
abstract member insertDatabase : Dynamics.AX.Application.Connection -> unit
override this.insertDatabase : Dynamics.AX.Application.Connection -> unit
Public Overridable Sub insertDatabase (_connection As Connection)

Parameters

_connection
Connection

Applies to