Knight Data Access Layer
Deleting Records VB.NET
Basic Tasks VB.NET > Deleting Data > Deleting Records VB.NET

Explicitly delete records by calling the Delete method.  There are methods to delete by object, by primary key, by passed parameters.  To do a delete of the object with the children, see Deleting with Children.

 

'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)

 

'Delete the record in the database

db.Delete(currentPerson)