S
spd260
Unregistered / Unconfirmed
GUEST, unregistred user!
请大家帮忙看一下这段代码错在哪?我用取得的sql 语名在 sql Explorer中可以执行得到要得到的结果,
但是代码在执行时报错
procedure Tmainform.Button1Click(Sender: TObject);
var sqlstr:string;
begin
sqlstr:='select csid,name,sex,age,baogaoriqi,money from patient';
sqlstr:=sqlstr+' union select null,null,null,null,';
sqlstr:=sqlstr+QuotedStr('合计:')+',sum(money) from patient order by baogaoriqi';
dm.qr.Close;
dm.qr.SQL.Clear;
dm.qr.SQL.Add(sqlstr);
dm.qr.Open;
end;
但是代码在执行时报错
procedure Tmainform.Button1Click(Sender: TObject);
var sqlstr:string;
begin
sqlstr:='select csid,name,sex,age,baogaoriqi,money from patient';
sqlstr:=sqlstr+' union select null,null,null,null,';
sqlstr:=sqlstr+QuotedStr('合计:')+',sum(money) from patient order by baogaoriqi';
dm.qr.Close;
dm.qr.SQL.Clear;
dm.qr.SQL.Add(sqlstr);
dm.qr.Open;
end;