L
leon2008go
Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个Button的事件如下: adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('if not object_id(''tb1'') is null drop table tb1'); adoquery1.ExecSQL ; adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('Create table tb1([TrnspName] nvarchar(3),[U_bumen] nvarchar(3),[LineTotal] int)'); adoquery1.ExecSQL ; adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add(adoquery3.SQL.Text); adoquery1.ExecSQL ; adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('select tb1.*,百分比=cast(cast(1.0*LineTotal /(select sum(LineTotal )from tb1)*100 as dec(6,2)) as varchar)+''%'' from tb1') ; adoquery1.Open ;其中adoquery3.SQL.Text的语句如下:Insert tb1 select #a.TrnspName,#a.U_bumen,sum(#a.LineTotal) as LineTotal from (select a.TrnspName,d.U_bumen,sum(b.LineTotal) as LineTotal from OSHP a join OITM c on a.TrnspCode=c.ShipTypejoin INV1 b on b.ItemCode=c.ItemCode join OINV d on b.DocEntry=d.DocEntry--where d.DocDate between :bd and :ed group by a.TrnspName,d.U_bumenwhere d.DocDate between '2009-1-1' and '2009-2-28' group by a.TrnspName,d.U_bumenunion allselect a1.TrnspName,d1.U_bumen,sum(-b1.LineTotal) as LineTotal from OSHP a1 join OITM c1 on a1.TrnspCode=c1.ShipTypejoin RIN1 b1 on b1.ItemCode=c1.ItemCode join ORIN d1 on b1.DocEntry=d1.DocEntry--where d1.DocDate between :bd and :ed group by a1.TrnspName,d1.U_bumen ) #awhere d1.DocDate between '2009-1-1' and '2009-2-28' group by a1.TrnspName,d1.U_bumen ) #agroup by #a.TrnspName,#a.U_bumenhaving #a.TrnspName<>'赠品材料' and #a.U_bumen='商场部'adoquery3.SQL.Text的语句是没错的,但是单击这个事件执行后出错,错误为:不正常地定义参数对象,提供了不一致或不完整的信息.请问哪里错了?