Y
yuanlaqin
Unregistered / Unconfirmed
GUEST, unregistred user!
程序以前使用正常,在数据库表中增加2个字段后出现invalid pointer operation;去掉了新增的2个字段,程序仍然出现上面的错误提示,大家帮着看看哪儿出错了?定义了几个变量var Form1: TForm1; nian, yue: integer; curdata, priordata, samemaxdata, hismaxdata, avgdatas: array of Single; samemaxyear, hismaxyear, hismaxmonth: array of integer; fieldnamestr, chnstr, danweistr: Tstringlist; readdata: Tstringlist;implementationprocedure TForm1.btn_saveClick(Sender: TObject);var strtabname, strorderby: string; i, j, fldcount: integer;begin nian := strtoint(cmb_year.Text); yue := strtoint(cmb_month.Text); case pg.ActivePageIndex of 0: //打开产量表,进行指标对比 begin strtabname := 'chanliang'; strorderby := 'desc'; fldcount := 23; end; 1: //打开技经表,进行指标对比 begin strtabname := 'jijing'; strorderby := 'desc'; fldcount := 41; end; 2: //打开消耗表,进行指标对比 begin strtabname := 'xiaohao'; strorderby := ' '; fldcount := 63; end; 3: exit; end; chnstr := Tstringlist.Create; danweistr := Tstringlist.Create; fieldnamestr := Tstringlist.Create; opencurtab(qry_cur, strtabname, nian, yue, fldcount); //打开当年表, openpriortab(qry_prior, strtabname, nian - 1, yue, fldcount); //打开上一年表, for i := 0 to qry_cur.FieldCount - 1 do begin if qry_cur.Fields.Value = null then qry_cur.Fields.Value := 0; samemax(qry_samemax, qry_cur.Fields, strtabname, yue, strorderby, fldcount); //打开同期最好表, Hismax(qry_hismax, qry_cur.Fields, strtabname, strorderby, fldcount); //打开历史最好表, avgdata(qry_avg, qry_cur.fields, strtabname, fldcount); // 求得该指标的平均值 chnname(qry_fieldname, qry_cur.Fields); //取得项目指标的汉字名称 end; case pg.ActivePageIndex of 0: begin for j := 0 to qry_cur.fieldcount - 1 do begin grd_cl.Columns[j].Title.Caption := chnstr[j]; grd_cl.Columns[j].Width := 90; end; end; 1: begin for j := 0 to qry_cur.fieldcount - 1 do begin grd_jj.Columns[j].Title.Caption := chnstr[j]; grd_jj.Columns[j].Width := 90; end; end; 2: begin for j := 0 to qry_cur.fieldcount - 1 do begin grd_xh.Columns[j].Title.Caption := chnstr[j]; grd_xh.Columns[j].Width := 90; end; end; 3: exit; end; saveasxls(qry_cur, fieldnamestr, chnstr, danweistr, curdata, priordata, samemaxdata, samemaxyear, hismaxdata, hismaxyear, hismaxmonth, strtabname, avgdatas);end;调用了几个自定义的过程