Skip to main content
nikos101
Inspiring
August 29, 2008
Question

What should I return if no rows are found?

  • August 29, 2008
  • 3 replies
  • 514 views
If I have a cf function that returns a query, what should I return if no rows are found?
This topic has been closed for replies.

3 replies

August 30, 2008
<cfif myquery.RecordCount IS 0>
Golly, we have no record of anyone by that name... sorry!
<cfelse>
By Golly Joe Schmoo is with us and says Hi!
</cfif>

should do the trick....
Inspiring
August 29, 2008
What do you return if records are found?
Inspiring
August 29, 2008
nikos101 wrote:
> If I have a cf function that returns a query,

A query object does not have to contain any records. A function can return an empty query, because it is still a query object. The calling page should check the query record count. Then determine what to display depending on the record count.