NetSuite Data Provider - Online Help
NetSuite Data Provider
Questions / Feedback?

LINQ Inserts

The following example illustrates inserting a record using LINQ.

using System.Linq;

NetSuiteEntities context = new NetSuiteEntities();

Account newRecord = new Account {
  AcctName = "Petty Cash"
};

context.Account.Add(newRecord);

try {
  context.SaveChanges();
} catch (Exception e) {
  Console.WriteLine(e);
}
Console.WriteLine(newRecord.Id);

Note: It is often useful to retrieve the result of the INSERT command; to obtain the Id of the new record, for example. You can do so by reading the Id from the record after it has been saved. The primary key, generated by the data source, will be assigned to the saved record.

 
 
Copyright (c) 2015 RSSBus, Inc. - All rights reserved.
Build 1.0.5578.0