Query:=TADOQuery.Create(self);
Query.Connection:=ADOConnection1;
Query.SQL.Text:='select name from user where username=name';
Query.Open;
if query.RecordCount=1 then
result:=true
else
result:=false;
Query.Close;
Query.Free;
数据库表的名字是user,字段分别是name ,key
參考答案:Query:=TADOQuery.Create(self);
Query.Connection:=ADOConnection1;
Query.SQL.add('select name from user where name=''name''');
Query.Open;
if query.RecordCount=1 then
result:=true
else
result:=false;
Query.Close;
Query.Free;