home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Help with notifying user of empty recordset in ASP

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2686
Discussions: 200,998, Posts: 2,379,985, Members: 246,368
Old May 11th, 2004, 06:21 PM   Digg it!   #1 (permalink)
Ultimate Member
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: Pasadena, CA
Posts: 2,177
Help with notifying user of empty recordset in ASP

Im making a page where the user enters in some information to find a person in a directory database. They can search by first or last name and/or by classroom number (for an elementary school website). The problem Im having is if no results are found (meaning an empty record set) then how can I notify the user of this?

I had the following code before but it wasn't working properly:
Code:
<% if Not(rsResults.bof AND rsResults.eof) then
                do while not rsResults.eof
%>

<tr>
   <td><%= rsResults("firstName") %>
                .
                .
                .
                .
   </td>
</tr>

<% 
                 rsResults.movenext
                 loop
        else
%>

<center> NO RESULTS FOUND </center>

<% end if %>
When there was just one result returned in the recordset it would show me the no results found. It seems like even tho there was still a record in the recordset, the rsResults was still at bof AND eof so it skipped straight to the else. Any ideas on how to properly test this, even if there is only 1 returned record in the record set?
__________________
YAH! I knew you'd be jealous
Tekk is offline   Reply With Quote
Old May 12th, 2004, 11:35 AM     #2 (permalink)
Senior Member
 
omalleytrading's Avatar
 
Join Date: Apr 2003
Location: Albany, NY
Posts: 623
Tekk,

This is the way I normally handle these things:

<%

If Not rsResults.EOF Then
While Not rsResults.EOF
' *** Do your normal processing here ***

rsResults.MoveNext
Wend

rsResults.Close
Else
Response.write "No results were found." & vbNewLine
End If

Set rsResults = Nothing
%>
omalleytrading is offline   Reply With Quote
Old May 17th, 2004, 03:28 AM     #3 (permalink)
Ultimate Member
 
Tekk's Avatar
 
Join Date: Oct 2001
Location: Pasadena, CA
Posts: 2,177
works perfect omalley! Thanks for the help.
Tekk is offline   Reply With Quote
Old May 19th, 2004, 03:45 PM     #4 (permalink)
Senior Member
 
omalleytrading's Avatar
 
Join Date: Apr 2003
Location: Albany, NY
Posts: 623
No problem -- glad I could help.
omalleytrading is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recordset Order div Webmastering and Programming 15 July 10th, 2009 02:29 AM
VB6 -- Data Combo Controls... SpaceMonkey Webmastering and Programming 12 April 21st, 2009 03:26 AM
Attn; thekingofpain and other Pet owners Richard Cranium IMO Community 7 August 21st, 2002 01:36 AM
Select Box - Dynamic Cursor? april Webmastering and Programming 9 June 29th, 2002 12:50 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3104)
‘Rogue’ or ‘Rouge’? (8)
Charges against non-tippers dropped.. (22)
Foxconn Blackops x48 MoBo (5)
Nvidia GTX 260 problem (14)
Delete an OS (18)
Laptop with wireless problem. (13)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
windows vista security holes (19)
[F@H SPAM 11/16/09] ! 1/2 months to.. (41)
windows 7 problem (7)
Recent Discussions
Computer shutting down on its own (6)
EVGA 9800 gtx help with finding a goo.. (13)
"Documents and Settings" fo.. (7)
Delete an OS (18)
Outputing 1080p from my PC to my 720p.. (0)
panasonic dmr ez48veb recorder (0)
add ram to existing (3)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Laptop with wireless problem. (13)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)
FreeAgent drive software not x64 comp.. (1)
Intel 5100 AGN issues fixed yet? (28)
Foxconn Blackops x48 MoBo (5)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (41)
Print spooler problem (17)
Q9650 vs. Q9550 (2)
Desktop Calendar Application (2)
Looking for new motherboard (1)
soundmon.exe (8)
Jedi Academy Problem (3)
Can a page file be "too big".. (1)
Size after cutting 700Mb file is 2.5 .. (0)
windows vista security holes (19)


All times are GMT -4. The time now is 01:27 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28