查询语句的问题
查询语句的问题 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiBase/html/delphi_20061207154244236.html
s1:='select username from userload where username='+''''+edit1.Text+'''';
datamodule2.Query3.SQL.Add(s1);
datamodule2.Query3.Open;
如果我想实现S1的结果再加个rights=1的条件该怎么写?
http://www.delphi2007.net/DelphiBase/html/delphi_20061207154244236.html
s1:='select username from userload where username='+''''+edit1.Text+'''';
datamodule2.Query3.SQL.Add(s1);
datamodule2.Query3.Open;
如果我想实现S1的结果再加个rights=1的条件该怎么写?
s1:='select username from userload where rights=1 and username='+''''+edit1.Text+'''';
s1:='select username from userload where username='''+edit1.Text+''' and rights=1';?
很奇怪哦.那如果rights同样也是一个从外界如edit2获取的值该怎样加呢!?
to risman,这个法不对~
if rights=1 then
begin
s1:='select username from userload where username='+''''+edit1.Text+'''';
datamodule2.Query3.SQL.Add(s1);
datamodule2.Query3.Open;
end;
s1:='select username from userload where username='+quotedstr(edit1.text)+' and rights='+ edit2.text;//如果rights是文本值(字串),那么,把edit2.text换成quotedstr(edit2.text)
上面是针对你继续问的“那如果rights同样也是一个从外界如edit2获取的值该怎样加呢!?”的回答