Knight Data Access Layer
Inserting Records
Basic Tasks C# > Saving Data > Inserting Records

Normally the save method can be called to perform an insert or an update.  To explicitly call insert, see the example below. 

//Get the current instance of the helper

IDataHelper db = DataHelper.SessionFactory();

 

//Create a new Person to save to the database

Person currentPerson = new Person();

currentPerson.FirstName = "John";

currentPerson.LastName = "Smith";

 

//Insert a record into the database using the properties from the object

db.Insert(currentPerson);