Knight Data Access Layer
Load DataTable VB.NET
Basic Tasks VB.NET > Loading Data > Load DataTable VB.NET

Use SQL to load data into a data table.

 

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

 

Dim sql As String = "select * from Person"

Dim dt As DataTable = db.GetDataTable(sql)