我在登陆页面里用Tquery控件时,用sql语句:
sql.add('select username,password from table where username=:user and password=:pass');
问题是我怎样得到select语句的返回值,应该有一个boolean类型的值以判断是否查询成功
if boolean=1 then 
showmessage('登陆成功’)
esle showmessage(‘用户名或密码出错,请核对后从新登陆’);
在Ttable控件里有一个gotokey,
if gotokey then ...
但是在Tquery里面呢?各位大侠如果有好的登陆方面的代码请贴出来,谢谢大家:)

解决方案 »

  1.   

    query1.close;
    query1.sql.text:='select username,password from table where username=:user and password=:pass';
    Query1.open;
    if not Query1.IsEmpty thenShowmessage('此人是合法用户')
    else
     ShowmMessage('此人是非法用户');
      

  2.   

    query1.close;
    query1.sql.text:='select username,password from table where username=:user and password=:pass';
    Query1.Params[0].Value:=edtUser.Text;
    Query1.params[1].Value:=edtPass.Text;
    Query1.open;
    if Query1.IsEmpty thenShowmMessage('此人是非法用户')else
     Showmessage('此人是合法用户');
      

  3.   

    query1.isempty 修改为 not query1.eof 应该也行