Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 4th, 2006, 03:34 AM
Friend of Wrox
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql count problem

when I use the following query if there is no record I get error
when I output <%=rsMsg("Msg_COUNT")%>
(either eof or bof is true.....)?

RSMsg.Open "SELECT cmm_inbox.id,cmm_inbox.status,(SELECT COUNT (*) from Cmm_inbox WHERE Cmm_inbox.Receiver =" & Session("UserID") & " ) AS Msg_COUNT FROM Cmm_Inbox where Cmm_Inbox.Receiver=" & Session("MyCmmUserID") & " and cmm_inbox.status='" & "new" & "'",conn,3,3

what should I do?

Old May 5th, 2006, 09:37 AM
Registered User
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to moooon

Just add the condition for checking EOF/BOF before you do the printing
IF rsMsg.EOF Then
    Response.Write "" ' ... whatever constant or variables u like
    Response.Write rsMsg("Msg_COUNT")
End If

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help for sql COUNT designwork SQL Language 4 December 29th, 2005 05:26 PM
sql COUNT problem jordancrandall SQL Language 6 October 18th, 2004 10:27 AM
SQL query for count programmer_kay ADO.NET 1 April 18th, 2004 02:48 AM
SQL query for count programmer_kay SQL Language 1 April 17th, 2004 07:30 PM
sql Count winnie1778 SQL Server 2000 7 November 7th, 2003 02:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.