with adoquey1 do begin close; sql.clear; sql.add('select * from peopleinfo where codeofoperator='+qutoedstr('A001')); sql.add('order by money,dateandtime'); open; end;
1.QuotedStr是delphi的函数,不是sql函数 ADOQuery的Add语句中只能这么使用 ADOQuery.SQL.Add('select * from tablename where name =' + QuotedStr('tom')); 2.定义变量,SQL语句赋给变量, 或者愿意的话 可以 ADOQuery.SQL.Add(SQL1); ADOQuery.SQL.Add(SQL2); .........
procedure TForm1.Button1Click(Sender: TObject);begin {问题一} with adoquery1 do begin close; sql.Clear; sql.Add('select * from x_eng where x_a='+QuotedStr(edit1.Text)); open; end; {问题二} with adoquery1 do begin close; sql.Clear; sql.Add('update x_eng set xx=1'+ {用加号分两行} ' where x_a=1'); ExecSQL; end; end;
begin
close;
sql.clear;
sql.add('select * from peopleinfo where codeofoperator='+qutoedstr('A001'));
sql.add('order by money,dateandtime');
open;
end;
ADOQuery的Add语句中只能这么使用
ADOQuery.SQL.Add('select * from tablename where name =' + QuotedStr('tom'));
2.定义变量,SQL语句赋给变量,
或者愿意的话
可以
ADOQuery.SQL.Add(SQL1);
ADOQuery.SQL.Add(SQL2);
.........
procedure TForm1.Button1Click(Sender: TObject);begin
{问题一}
with adoquery1 do begin
close;
sql.Clear;
sql.Add('select * from x_eng where x_a='+QuotedStr(edit1.Text));
open;
end; {问题二}
with adoquery1 do begin
close;
sql.Clear;
sql.Add('update x_eng set xx=1'+ {用加号分两行}
' where x_a=1');
ExecSQL;
end;
end;