Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 5th, 2004, 10:04 AM
chris_crooks chris_crooks is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 chris_crooks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Empty Query Result Error Message

Hi,

I am querying tables by the user entering a code into a text box in a form.
An append query then uses the value entered to search a table and append
any matching results into a new table. This new table is then shown as a new form.
Rather than displaying an empty form when no matching results are found
I want an error message to be displayed.

How can I check if there are any matching records and display an error message if needed?

Thanks

Reply With Quote
  #2  
Old April 14th, 2004, 07:32 PM
seaview seaview is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 14 seaview User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi,

One of the way to do this is to check the param called @@ROWCOUNT which stores the value of the rows affected by your last sql query. E.g. @@ROWCOUNT = 0. 0 means no matching result from the search. You can get more information on the usage of @@ROWCOUNT in SQL book online. All the best!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Empty Query Result Error Message


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway