Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Empty RecordSet and RecordCount

Posted on 2005-03-16
Medium Priority
Last Modified: 2013-12-24
I'm trying to figure something out here...

<cfquery name=myquery>
select *
from table
where empid = ...

<cfif myquery.recordcount GT 0>
Put data here
There is no data found.

If the query returns the empty recordset the cfif statement doesn't recognize any recordcount so the result ends up just being blank.  I want the result to be if the query returns an empty recordset, to say that there are no records.  What am I missing?
Question by:Lee R Liddick Jr

Expert Comment

ID: 13557380
It should be working as it is.

Author Comment

by:Lee R Liddick Jr
ID: 13557433
it is not...when the query comes back with nothing, the page shows nothing.
LVL 25

Accepted Solution

James Rodgers earned 400 total points
ID: 13557474
i use this synatax

<cfif getComments.recordCount NEQ 0>

always works for me...
[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

LVL 21

Expert Comment

ID: 13557516
Hi leerljr68,
it may be possible that the query has null value and returning you the one record with empty cells or null values.
otherwise syntax is fine.

LVL 36

Expert Comment

ID: 13557768
simple way of checking is


Author Comment

by:Lee R Liddick Jr
ID: 13557868
That did it jester!  Once again...thank you.
LVL 25

Expert Comment

by:James Rodgers
ID: 13558907
glad i could help

thanks for the points

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question