?
Solved

Empty RecordSet and RecordCount

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

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

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

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?
0
Comment
Question by:Lee R Liddick Jr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:INSDivision6
ID: 13557380
It should be working as it is.
0
 

Author Comment

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

Accepted Solution

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

<cfif getComments.recordCount NEQ 0>

always works for me...
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 21

Expert Comment

by:pinaldave
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.

Regards,
---Pinal
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 13557768
simple way of checking is

<cfoutput>#myquery.recordcount#</cfoutput>
0
 

Author Comment

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

Expert Comment

by:James Rodgers
ID: 13558907
glad i could help

thanks for the points
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

764 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