[V4RB] Best Way to see if a value exists?

Karen keatk at comcast.net
Sun May 30 11:07:25 CDT 2004


Right now I'm doing:

Dim cur as VCursor, ValueExists as boolean

Cur = db.SQLSelect("SELECT field FROM table WHERE Field = 'something')

ValueExists = Cur <> NIL AND Cur.RecordCount > 0




I was wondering if the following would be faster:


Dim cur as VCursor, ValueExists as boolean

Cur = db.SQLSelect("SELECT Count(field) FROM table WHERE Field = 
'something')

ValueExists = Cur <> NIL AND Cur.ULongField(1).Value <> 0


Also would that be he right way for that way of doing it?
I am assuming here that a count is a ULongField.
I am also assuming Cur.RecordCount can never be 0,  as a count of 0 
should still return a "record"


- karen



More information about the Valentina mailing list