we got this sql query:
Select EmployeeDesignation from Employee where EmployeeName = Paramater1
(Parameter1 is value is passed to this)
We are using this statement:
lEmployeeDesignation = _SQLCommand.ExecuteScalar()
3 scenario’s:
- Returns the employee Designation (record exists in table)
- No value is set in database for Parameter1 – so should return NULL (record exists but has no value)
- No employee record exists so returns nothing (record doesn’t exists)
I’m struggling with 2 and 3 scenario – incase of Scenario 3 we want the application to fail, but struggling how to trap this error.
regards
Notice the use of AndAlso to shortcircuit the evaluation process. If the first condition is false then the second one is not evaluated