M
Mike P
Is it OK to use ExecuteScalar if there is a possibility that the SQL it
uses may not return a value? I'm asking this because I have a table
with a particular field (call it Department) and then another field
(call it Department number). Now I want to find the last record with a
particular Department, so that for the one I am going to add, I can add
1 to the Department number I have found to give the new record the next
ascending Department number.
I am using ExecuteScalar, but in the situation where there are not yet
any members of that Department, I need to check this before assigning
the return value of ExecuteScalar. How do I do this?
Thanks,
Mike
uses may not return a value? I'm asking this because I have a table
with a particular field (call it Department) and then another field
(call it Department number). Now I want to find the last record with a
particular Department, so that for the one I am going to add, I can add
1 to the Department number I have found to give the new record the next
ascending Department number.
I am using ExecuteScalar, but in the situation where there are not yet
any members of that Department, I need to check this before assigning
the return value of ExecuteScalar. How do I do this?
Thanks,
Mike