首页 > 代码库 > 数据集sql语句写法

数据集sql语句写法

写法1:直接把变量值包含在sql的表达式中;

with frmDataPool.qry用户账号表 do
 begin
  Close;
  SQL.Text:=‘select * from 用户账号表 where admid = ‘ + QuotedStr(edtAdmid.Text) + ‘ AND admps = ‘ + QuotedStr(edtAdmps.Text);
  Open;
 end;

写法2:用参数

with frmDataPool.qry用户账号表 do
begin
  Close;
  SQL.Text:=‘select * from 用户账号表 where admid = :admid  AND admps =:admps ‘;  
  Parameters.ParamByName(‘admid‘).Value:=edtAdmid.Text; //为admid参数赋值; 
  Parameters.ParamByName(‘admps‘).Value:=edtAdmps.Text; //为admps参数赋值;
  Open; 
end;

  

 

数据集sql语句写法