Link to home
Start Free TrialLog in
Avatar of ST3VO
ST3VOFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Help Needed with TQuery SQL Error

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
Avatar of rfwoolf
rfwoolf
Flag of South Africa image

Could you perhaps do a record count on the dataset?
i.e.
if ADOQuery1.RecordCount > 0 then do
  begin
etc
ASKER CERTIFIED SOLUTION
Avatar of bokist
bokist
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ST3VO

ASKER

Excellent!!! Worked Great! Thanks!