Use the Execute Scalar to return a single value. Optional parameters may be passed in.
'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
parms As New Dictionary(Of String, Object)()parms.Add(
"FirstName", "John")parms.Add(
"LastName", "Smith")Dim
sql As String = "SELECT COUNT(1) FROM Person WHERE FirstName=@FirstName AND LastName=@LastName"
Dim
results As Long = CLng(Fix(db.ExecuteScalar(sql,parms)))