Код:
select count(*) as cnt from Table where bla-bla-bla
а потом спрашиваешь поле cnt
Код:
if IBQuery1.FieldByName('cnt').AsInteger = 0 then
raise exception.create('wrong username and/or password');
А еще можно RecordCount спросить у запроса.
[/code]