Checking to see if query is empty

Hey guys,

What’s the best way to check if a db query contains any rows?


<cfif myQuery.RecordCount GT 0>


Brilliant. Thanks!!!

actually you don’t even need the GT 0 just the <cfif myQuery.RecordCount> …stuff … </cfif> since myQuery.RecordCount will evaluate to a number.

[font=Courier New]It will. But it reads a little better having the GT 0 in there don’t you think?


Sort of…if you know that a CFIF ONLY tests if something is true or false AND only processes if the result is true, then it reads just fine.