Knight Data Access Layer
Performing Searches VB.NET
Basic Tasks VB.NET > Loading Data > Performing Searches VB.NET

Performing Searches

Searching can be performed in several different ways in Knight Data Access Layer. 

 

Performing an Exact Search

The built in search mechanism will search for exact values that are not the default value.  By not setting a value, it will not be searched.

 

'Create a new Person to save to the database

Dim currentPerson As New Person()

currentPerson.FirstName = "John"

currentPerson.LastName = "Smith"

 

'Get the current instance of the helper

Dim db As IDataHelper = DataHelper.SessionFactory()

 

'Save it to the database

db.Save(currentPerson)

 

'Search parameters

Dim searchParm As New Person()

searchParm.FirstName = "John"

 

'Search for records based on the passed in search object

Dim personList As List(Of Person) = _db.Search(Of Person)(searchParm, 50)