var lx:string; begin adoquery1.close; adoquery1.sql.text := 'select type from usertbl where Userid=''ID001''';//查找用户编号为“ID001”的用户类型 adoquery1.open; if adoquery1.RecordCount> 0 then lx:= adoquery1.fieldbyname('type').asstring else messagebox(SELF.Handle,'系统中没有该用户编号!','警告!',MB_ICONSTOP); end;
ADOconnection1.Open;
ADOquery1.Connection:= ADOconnection1;
ADOquery1.SQL.Clear;
ADOquery1.SQL.Add('根据用户名和密码查询出你想要的字段,当然要包括 type');
ADOquery1.Open;
通过
ADOquery1.FieldByName('type').Value;
这样子来获得 type 的值
lx:string;
begin
adoquery1.close;
adoquery1.sql.text := 'select type from usertbl where Userid=''ID001''';//查找用户编号为“ID001”的用户类型
adoquery1.open;
if adoquery1.RecordCount> 0 then
lx:= adoquery1.fieldbyname('type').asstring
else
messagebox(SELF.Handle,'系统中没有该用户编号!','警告!',MB_ICONSTOP);
end;