Checking to see if query is empty

Hey guys,

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

Thanks!

<cfif myQuery.RecordCount GT 0>

</cfif>

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?

[/font]

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.