473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

qry returns nothing (no data matched qry)

I want to know how to determine if a qry through ASP to a access database returns nothing (ie. there is no record that matches the query). I want to write a message stating no matches found if no records match the search.

Here's the portion of code:

<%
dim strArtType
Set objRS = Server.CreateObject("ADODB.recordset")
objRS.open strSQL, strConnect

**!!?? Is there a boolean result for something like this??!!**
if objRS("Title") = empty then
response.write "The value of title is: "& objRS ("Title")
end if

if objRS("Title") = "" then
response.write "<br>~~No art matches search as entered~~<br>"
end if
do while not objRS.EOF
response.write "<TR>"
response.write "<TD><p>'" & objRS("Title") & "'</p></TD>"
response.write "<TD><p>" & objRS("Name")
"</p></TD>"
response.write "<TD><p>" & objRS("Date") & "</p></TD>"
if objRS("Type") = 1 then
strArtType = "Painting"
else
strArtType = "Sculpture"
end if
response.write "<TD><p>" & ">" & strArtType & "<" & "</p></TD>"
response.write "</TR>"
objRS.MoveNext
Loop
objRS.close
%>

--------------------------------
From: Bob Green

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>V2FZXRzWQ0qv1PEx2KYieQ==</Id>
Nov 18 '05 #1
2 1203
Try this:

if objRS.EOF then
response.write "<br>~~No art matches search as entered~~<br>"
else
'do your while loop here
end if
--
--
Sebastian W.
Nov 18 '05 #2
or you can try this:

if isNull(objRS("Title")) then
response.write "Empty recordset"
end if

you can try isEmpty, but I think that my first reply objRS.EOF will work
just fine

--
--
Sebastian W.
"Sebastian" <po*****@mail.com> wrote in message
news:eF**************@TK2MSFTNGP11.phx.gbl...
Try this:

if objRS.EOF then
response.write "<br>~~No art matches search as entered~~<br>"
else
'do your while loop here
end if
--
--
Sebastian W.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Deane | last post by:
Has anyone had experience with "function_exists" not finding a function that you KNOW you've defined? I have defined a function we'll call "foo": 1. I know that function has been parsed, because...
7
by: Danny | last post by:
Newbie here Thanks for the help with this command: print "Status: 204 No Content\n\n"; which returns nothing in a perl script. This is great because I just want my perl script to increment a...
2
by: Bob Green via .NET 247 | last post by:
I want to know how to determine if a qry through ASP to a access database returns nothing (ie. there is no record that matches the query). I want to write a message stating no matches found if no...
3
by: Sven | last post by:
Hello, I am trying to store an object and its type in a database table as text and then restore the object to its original form. I have created a couple of functions to help me with this: ...
0
by: S. B | last post by:
Hello all, I have some trouble with the following code snippet that is at the end of the post. The function is supposed to browse all members from a form or a user control to find all menuitems....
8
by: Sam | last post by:
Hi, Here is my code : For Each row As DataRow In m_dsTabs.Tables(0).Rows If CInt(row("TabId")) = DirectCast(tabQryTabs.SelectedTab, QueryTabPage).TabId Then...
3
by: Boni | last post by:
Dear all, Dim miType As Type = System.Type.GetType("System.Windows.Forms.MenuItem") returns nothing. Why? How can I get a Type "pointer" to System.Windows.Forms.MenuItem Tnanks, Boni
2
by: Jav | last post by:
I need to get at the ProviderUserKey of the logged in user. I would have thought that I could do something like: Dim u As MembershipUser = Membership.GetUser Dim ProvKey as Guid =...
0
by: jyuan | last post by:
Hi, I have two dropdownlist template columns in datagrid. Once the first one (Test Type, in column index 2, ID="ddlTestTypeID") selection changed, I need to re-bound the second dropdownlist (test...
1
by: Sand Yaah | last post by:
i went thru a discussion put by eros and helped out by dmjpros. d questions asked were right and i tried each but there was no problem there. my code returns null in xmlHttp.responseXML and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.