各位由于没有SQL,这些句子运行都出现Undeclared identifier:adoquery.sql不知是否能用?
我用DELPHI自有的order选4个字段,第四个为EmpNo.编了一个只对列求和的程序,可益出了。各位帮看看哪不对,
procedure TForm1.Button1Click(Sender: TObject);
var
sd:integer;
begin
with Table1 Do
begin
sd:=0;
first;
while not EOF do
sd:=sd+Fields[3].value;
next;
end;
Edit1.text:=IntToStr(sd);
end;
monthBegin,monthend:string;
monthBegin:=yearedit.text+'-'+monthedit.text+'-01';
monthEnd:=yearedit.text+'-'+inttostr(strtoint(monthedit.text)+1)+'-01';
'select sum(金额) from table where 日期>='+quotedstr(monthbegin)+' and 日期<'+quotedstr(monthEnd);
procedure TForm2.Button1Click(Sender: TObject);
var date,date1,date2:datetime;
begin
date1:=strtodate(spinedit1.text);
while date1<strtodate(spinedit2.text) do
begin
adoquery.sql.clear;
adoquery.sql.add('select '',金额 from table1
union
select '合计',sum(金额) from table1');
adoquery.open;
date1:=date1+1;
end;
end;
试试