Knight Data Access Layer
Updating Records VB.NET
Basic Tasks VB.NET > Saving Data > Updating Records VB.NET

Normally the Save Method is used to perform updates.  To perform an explicit update, see the example below.

'Get the current instance of the helper

Dim db As IDataHelper = DataHelper.SessionFactory()

 

'Create a new Person to save to the database

Dim currentPerson As New Person()

currentPerson.FirstName = "John"

currentPerson.LastName = "Smith"

 

'Save it to the database

db.Save(currentPerson)

 

'Change a property

currentPerson.FirstName = "Jane"

 

'Save the change

db.Update(Of Person)(currentPerson)