I added a comment earlier but seen as though everyone has jumped on the answer wagon here goes;
SELECT Code FROM AS_Table WHERE NumAtend = 1234 AND LEN(Code) > 0
By adding the LEN(Code) > 0
will cause only results with Code
with a length greater then 0 to be returned.
In each instance you want a ADODB.Recordset
to be returned or you will not be able to check the Recordset.EOF
property this is because the ADODB.Recordset
will have a Recordset.State
of adStateClosed
and any attempt to access it's properties will return an error (adErrObjectClosed
).
Error No. | Description
------------------------------------------------------------------
-2146824578 | Operation is not allowed when the object is closed.
What about using RETURN?
The problem with RETURN
is you will not get a resultset back so the ADODB.Recordset
will be in the state adStateClosed
and the same as above will apply.
Useful Links