我用delphi5.0+BDE+paradox开发的一个管理系统,但执行一个query1.sql时出现错误“access violation at addres

  • 主题发起人 主题发起人 libaoliang
  • 开始时间 开始时间
L

libaoliang

Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi5.0+BDE+paradox开发的一个管理系统,但执行一个query1.sql时出现错误“access violation at address 4BE346A7 in moudle 'IPAPI.DLL'. write of address 571AD6C4”请高手们指点一二,就(5分)<br />我用delphi5.0+BDE+paradox开发的一个管理系统,但执行一个query1.sql时出现错误
“access violation at address 4BE346A7 in moudle 'IPAPI.DLL'. write of
address 571AD6C4”请高手们指点一二,就这点积蓄了,
事成之后一定加倍奉还!
query1执行两次,其中dbgird与其对应的第二次执行结果合计部分是错误的,合计数有的不对!
请看代码后告诉我问题出在哪里?
源代码如下:
procedure Ttj1.BitBtn1Click(Sender: TObject);
var p:string;
begin
with table1 do
begin
close;
emptytable;
end;
p:='insert into zhbbk0(cpmc,zpzl,cpl,cpll,yjp,yjl,hgs,hgl,a01,l1,b01,l2,b02,';
p:=p+'l3,b03,l4,b04,l5,b05,l6,b06,l7,b07,l8,b21,l9,a03,l10,a02,l11,b11,l12,b12,l13,b13,l14,';
p:=p+'b14,l15,b15,l16,b16,l17,b18,l18,c01,l19,c03,l20,c02,l21,c04,l22,d01,l23,';
p:=p+'c06,l24,c05,l25,d04,l26,d03,l27,d05,l28,d07,l29,d02,l30,d06,l31,';
p:=p+'b08,l32,b20,l33,b19,l34,hj,l35) select cpmc,sum(zpzl),sum(cpl),';
p:=p+'sum(cpl)*100/sum(zpzl),sum(yjp),sum(yjp)*100/sum(cpl),';
p:=p+'sum(zpzl-a01-b01-b02-b03-b04-b05-b06-b07-b21-a03-a02-b11-b12-b13-b14-b15-b16-b18-c01-c03-c02-c04-d01-c06-c05-d04-d03-d05-d07-d02-d06-b08-b20-b19),';
p:=p+'sum(zpzl-a01-b01-b02-b03-b04-b05-b06-b07-b21-a03-a02-b11-b12-b13-b14-b15-b16-b18-c01-c03-c02-c04-d01-c06-c05-d04-d03-d05-d07-d02-d06-b08-b20-b19)*100/sum(zpzl),';
p:=p+'sum(a01),sum(a01)*100/sum(zpzl),sum(b01),sum(b01)*100/sum(zpzl),';
p:=p+'sum(b02),sum(b02)*100/sum(zpzl),sum(b03),sum(b03)*100/sum(zpzl),';
p:=p+'sum(b04),sum(b04)*100/sum(zpzl),sum(b05),sum(b05)*100/sum(zpzl),';
p:=p+'sum(b06),sum(b06)*100/sum(zpzl),sum(b07),sum(b07)*100/sum(zpzl),';
p:=p+'sum(b21),sum(b21)*100/sum(zpzl),sum(a03),sum(a03)*100/sum(zpzl),';
p:=p+'sum(a02),sum(a02)*100/sum(zpzl),sum(b11),sum(b11)*100/sum(zpzl),';
p:=p+'sum(b12),sum(b12)*100/sum(zpzl),sum(b13),sum(b13)*100/sum(zpzl),';
p:=p+'sum(b14),sum(b14)*100/sum(zpzl),sum(b15),sum(b15)*100/sum(zpzl),';
p:=p+'sum(b16),sum(b16)*100/sum(zpzl),sum(b18),sum(b18)*100/sum(zpzl),';
p:=p+'sum(c01),sum(c01)*100/sum(zpzl),sum(c03),sum(c03)*100/sum(zpzl),';
p:=p+'sum(c02),sum(c02)*100/sum(zpzl),sum(c04),sum(c04)*100/sum(zpzl),';
p:=p+'sum(d01),sum(d01)*100/sum(zpzl),sum(c06),sum(c06)*100/sum(zpzl),';
p:=p+'sum(c05),sum(c05)*100/sum(zpzl),sum(d04),sum(d04)*100/sum(zpzl),';
p:=p+'sum(d03),sum(d03)*100/sum(zpzl),sum(d05),sum(d05)*100/sum(zpzl),';
p:=p+'sum(d07),sum(d07)*100/sum(zpzl),sum(d02),sum(d02)*100/sum(zpzl),';
p:=p+'sum(d06),sum(d06)*100/sum(zpzl),sum(b08),sum(b08)*100/sum(zpzl),';
p:=p+'sum(b20),sum(b20)*100/sum(zpzl),sum(b19),sum(b19)*100/sum(zpzl),';
p:=p+'sum(a01+b01+b02+b03+b04+b05+b06+b07+b21+a03+a02+b11+b12+b13+b14+b15+b16+b18+c01+c03+c02+c04+d01+c06+c05+d04+d03+d05+d07+d02+d06+b08+b20+b19),';
p:=p+'sum(a01+b01+b02+b03+b04+b05+b06+b07+b21+a03+a02+b11+b12+b13+b14+b15+b16+b18+c01+c03+c02+c04+d01+c06+c05+d04+d03+d05+d07+d02+d06+b08+b20+b19)*100/sum(zpzl) ';
p:=p+' from cpk0 where (rq between :rq1 and :rq2) group by cpmc having(sum(zpzl)>0)';
query1.close;
query1.sql.Clear;
query1.sql.add(p);
query1.parambyname('rq1').asdate:=datetimepicker1.date;
query1.parambyname('rq2').asdate:=datetimepicker2.date;
query1.execsql;
p:='select cpmc as 产品名称,sum(zpzl) as 装坯数,sum(cpl) as 产量,';
p:=p+'sum(cpl)*100/sum(zpzl) as 成品率,sum(yjp) as 一级品,';
p:=p+'sum(yjp)*100/sum(cpl) as 一级率,';
p:=p+'sum(ejp) as 二级品,sum(sjp) as 三级品,sum(sijp) as 四级品,';
p:=p+'sum(cp) as 次品,sum(fp) as 废品,sum(sh) as 损耗,';
p:=p+'sum(zpzl-a01-b01-b02-b03-b04-b05-b06-b07-b21-a03-a02-b11-b12-b13-b14-b15-b16-b18-c01-c03-c02-c04-d01-c06-c05-d04-d03-d05-d07-d02-d06-b08-b20-b19) as 合格品,';
p:=p+'sum(zpzl-a01-b01-b02-b03-b04-b05-b06-b07-b21-a03-a02-b11-b12-b13-b14-b15-b16-b18-c01-c03-c02-c04-d01-c06-c05-d04-d03-d05-d07-d02-d06-b08-b20-b19)*100/sum(zpzl) as 合格率,';
p:=p+'sum(a01) as 泥脏,sum(a01)*100/sum(zpzl) as 比率,';
p:=p+'sum(b01) as 开裂,sum(b01)*100/sum(zpzl) as 比率,';
p:=p+'sum(b02) as 变形,sum(b02)*100/sum(zpzl) as 比率,';
p:=p+'sum(b03) as 缺坯,sum(b03)*100/sum(zpzl) as 比率,';
p:=p+'sum(b04) as 缺釉,sum(b04)*100/sum(zpzl) as 比率,';
p:=p+'sum(b05) as 疙瘩,sum(b05)*100/sum(zpzl) as 比率,';
p:=p+'sum(b06) as 釉泡,sum(b06)*100/sum(zpzl) as 比率,';
p:=p+'sum(b07) as 欠把,sum(b07)*100/sum(zpzl) as 比率,';
p:=p+'sum(b21) as 色脏,sum(b21)*100/sum(zpzl) as 比率,';
p:=p+'sum(a03) as 铁点,sum(a03)*100/sum(zpzl) as 比率,';
p:=p+'sum(a02) as 花泥,sum(a02)*100/sum(zpzl) as 比率,';
p:=p+'sum(b11) as 起泡,sum(b11)*100/sum(zpzl) as 比率,';
p:=p+'sum(b12) as 泥渣,sum(b12)*100/sum(zpzl) as 比率,';
p:=p+'sum(b13) as 断把,sum(b13)*100/sum(zpzl) as 比率,';
p:=p+'sum(b14) as 阴裂,sum(b14)*100/sum(zpzl) as 比率,';
p:=p+'sum(b15) as 滚釉,sum(b15)*100/sum(zpzl) as 比率,';
p:=p+'sum(b16) as 歪把,sum(b16)*100/sum(zpzl) as 比率,';
p:=p+'sum(b18) as 洇线,sum(b18)*100/sum(zpzl) as 比率,';
p:=p+'sum(c01) as 落脏,sum(c01)*100/sum(zpzl) as 比率,';
p:=p+'sum(c03) as 碰坯,sum(c03)*100/sum(zpzl) as 比率,';
p:=p+'sum(c02) as 碰损,sum(c02)*100/sum(zpzl) as 比率,';
p:=p+'sum(c04) as 夹口,sum(c04)*100/sum(zpzl) as 比率,';
p:=p+'sum(d01) as 生烧,sum(d01)*100/sum(zpzl) as 比率,';
p:=p+'sum(c06) as 粘疤,sum(c06)*100/sum(zpzl) as 比率,';
p:=p+'sum(c05) as 粘笼,sum(c05)*100/sum(zpzl) as 比率,';
p:=p+'sum(d04) as 闭光,sum(d04)*100/sum(zpzl) as 比率,';
p:=p+'sum(d03) as 桔釉,sum(d03)*100/sum(zpzl) as 比率,';
p:=p+'sum(d05) as 线不匀,sum(d05)*100/sum(zpzl) as 比率,';
p:=p+'sum(d07) as 炸瓷,sum(d07)*100/sum(zpzl) as 比率,';
p:=p+'sum(d02) as 氧化不好,sum(d02)*100/sum(zpzl) as 比率,';
p:=p+'sum(d06) as 烟熏,sum(d06)*100/sum(zpzl) as 比率,';
p:=p+'sum(b08) as 毛孔,sum(b08)*100/sum(zpzl) as 比率,';
p:=p+'sum(b20) as 釉流,sum(b20)*100/sum(zpzl) as 比率,';
p:=p+'sum(b19) as 其它,sum(b19)*100/sum(zpzl) as 比率,';
p:=p+'sum(a01+b01+b02+b03+b04+b05+b06+b07+b21+a03+a02+b11+b12+b13+b14+b15+b16+b18+c01+c03+c02+c04+d01+c06+c05+d04+d03+d05+d07+d02+d06+b08+b20+b19) as 缺陷合计,';
p:=p+'sum(a01+b01+b02+b03+b04+b05+b06+b07+b21+a03+a02+b11+b12+b13+b14+b15+b16+b18+c01+c03+c02+c04+d01+c06+c05+d04+d03+d05+d07+d02+d06+b08+b20+b19)*100/sum(zpzl) as 缺陷率 from cpk0 ';
p:=p+'where (rq between :rq1 and :rq2) group by cpmc having(sum(zpzl)>0)';
query1.close;
query1.sql.clear;
query1.sql.add(p);
query1.parambyname('rq1').asdate:=datetimepicker1.date;
query1.parambyname('rq2').asdate:=datetimepicker2.date;
query1.open;
bitbtn3.Enabled:=true;
bitbtn4.Enabled:=true;
checkbox1.enabled:=true;
end;

 
现在DFW怎么了?我明显感到人气不旺了,
以前提出一个问题很快有人回答,
现在放三天竟无人过问!
上面的问题我反复调试了,只要把最长的累加部分减少一个字段就能够通过,
否则报错,但错误却指示到下一条无错的'select cpmc as 产品名称'语句上,
非常奇怪,
是编译器不支持太长的sql还是使用的字段太多,我感到奇怪,
难道就没有同感的吗?如果是在乎分数太少而不愿回答,那我是真感到虚拟的
世界中也有功利现象而感到可悲了!
再说,我实在是没有分数可分了,而不是不愿意出!








 
后退
顶部