[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Help Needed with TQuery SQL Error

Posted on 2007-11-16
3
Medium Priority
?
192 Views
Last Modified: 2010-04-21
Hi all,

I am having a problem with an SQL Query.

This is the code:

 ADOQuery1.SQL.Add('select * from TheTable where (Make) = "' + (Edit1.Text) + '"');

Now...this wrks fine IF results are found but I get an error if there are no matches found.

How could I modify this so that IF there are no matches found I can do a Showmessage('No Matches Found') or something link this.

Hope you can help!

Thanks

ST3VO
0
Comment
Question by:ST3VO
[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
3 Comments
 
LVL 13

Expert Comment

by:rfwoolf
ID: 20297269
Could you perhaps do a record count on the dataset?
i.e.
if ADOQuery1.RecordCount > 0 then do
  begin
etc
0
 
LVL 6

Accepted Solution

by:
bokist earned 2000 total points
ID: 20297270
Try this way:

ADOQuery1.SQL.Add('select * from TheTable where (Make) = "' + (Edit1.Text) + '"');
ADOQuery1.Open;
if ADOQuery1.EOF  then  
  begin
  Showmessage('No Matches Found') ;
  Exit;
end;
0
 

Author Closing Comment

by:ST3VO
ID: 31409525
Excellent!!! Worked Great! Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 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