아래의 소스 컴파일해서 프로그램 실행중에 "Parameter 'Prdcod_' not found"라는 에러가 발생하는데 ...어디가 잘못된건지....아시는분 좀 갈켜주세요...
procedure TForm1.querybitbtn1Click(Sender: TObject);
var
i:integer;
begin
with query1 do
begin
close;
sql.clear;
sql.add('drop table bmt750t');
execsql;
close;
sql.clear;
sql.add('create table bmt750T(');
sql.add('prdcod char(13),');
sql.add('up2 char(7),');
sql.add('el numeric(10),');
sql.add('sl numeric(10),');
sql.add('bo numeric(10),');
sql.add('hn numeric(10))');
execsql;
end;//with
with query1 do
begin
close;
sql.clear;
sql.add(' select * ');
sql.add(' from bmt750');
sql.add(' where stkyr+stkmm+stkdd>=20001129');
open;
first;
while not eof do
begin
parambyname('prdcod_').asstring:=fieldbyname('prdcod').asstring;
if fieldbyname('stkid').asstring='el' then
parambyname('el_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
else
if fieldbyname('stkid').asstring='sl' then
parambyname('sl_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
else
if fieldbyname('stkid').asstring='bo' then
parambyname('bo_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
else
if fieldbyname('stkid').asstring='hn' then
parambyname('hn_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger;
// end;
with query2 do
begin
close;
sql.add('insert into bmt750t (prdcod,up2,el,sl,bo,hn)');
sql.add('values (:prdcod_,,:el_,:sl_,:bo_,:hn_)');
execsql;
close;
end;//with
next;
end;//while
end;//with
with query1 do
begin
i:=0;
close;
sql.clear;
sql.add('select prdcod,up2,el,sl,bo,hn');
sql.add('from bmt750t');
open;
first;
i:=1;
stringgrid1.rowcount:=recordcount+1;
while not eof do
begin
stringgrid1.cells[0,i]:=fieldbyname('prdcod').asstring;
stringgrid1.cells[1,i]:=fieldbyname('up2').asstring;
stringgrid1.cells[2,i]:=fieldbyname('el').asstring;
stringgrid1.cells[3,i]:=fieldbyname('sl').asstring;
stringgrid1.cells[4,i]:=fieldbyname('bo').asstring;
stringgrid1.cells[5,i]:=fieldbyname('hn').asstring;
next;
inc(i);
end;//while
close; //query1
sql.clear;
sql.add('drop table bmt750t');
execsql;
close;
end; //with
end; //처음 begin
위치를 수정하시는게.......
에궁 맞나몰라....즐프하세여~
while not eof do
begin
with query2 do
begin
parambyname('prdcod_').asstring:=fieldbyname('prdcod').asstring;
if fieldbyname('stkid').asstring='el' then
parambyname('el_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
else if fieldbyname('stkid').asstring='sl' then
prambyname('sl_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').sinteger
else if fieldbyname('stkid').asstring='bo' then
parambyname('bo_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
else
if fieldbyname('stkid').asstring='hn' then
parambyname('hn_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger;
// end;
close;
sql.add('insert into bmt750t (prdcod,up2,el,sl,bo,hn)');
sql.add('values (:prdcod_,,:el_,:sl_,:bo_,:hn_)');
execsql;
close;
end;//with
next;
end;//while
end;//with
> with query1 do
> begin
> i:=0;
> close;
> sql.clear;
> sql.add('select prdcod,up2,el,sl,bo,hn');
> sql.add('from bmt750t');
> open;
> first;
> i:=1;
> stringgrid1.rowcount:=recordcount+1;
> while not eof do
> begin
> stringgrid1.cells[0,i]:=fieldbyname('prdcod').asstring;
> stringgrid1.cells[1,i]:=fieldbyname('up2').asstring;
> stringgrid1.cells[2,i]:=fieldbyname('el').asstring;
> stringgrid1.cells[3,i]:=fieldbyname('sl').asstring;
> stringgrid1.cells[4,i]:=fieldbyname('bo').asstring;
> stringgrid1.cells[5,i]:=fieldbyname('hn').asstring;
> next;
> inc(i);
> end;//while
델이랑파이랑 wrote:
> 아래의 소스 컴파일해서 프로그램 실행중에 "Parameter 'Prdcod_' not found"라는 에러가 발생하는데 ...어디가 잘못된건지....아시는분 좀 갈켜주세요...
>
> procedure TForm1.querybitbtn1Click(Sender: TObject);
> var
> i:integer;
>
> begin
> with query1 do
> begin
> close;
> sql.clear;
> sql.add('drop table bmt750t');
> execsql;
>
> close;
> sql.clear;
> sql.add('create table bmt750T(');
> sql.add('prdcod char(13),');
> sql.add('up2 char(7),');
> sql.add('el numeric(10),');
> sql.add('sl numeric(10),');
> sql.add('bo numeric(10),');
> sql.add('hn numeric(10))');
> execsql;
> end;//with
>
> with query1 do
> begin
> close;
> sql.clear;
> sql.add(' select * ');
> sql.add(' from bmt750');
> sql.add(' where stkyr+stkmm+stkdd>=20001129');
> open;
> first;
>
> while not eof do
> begin
>
> parambyname('prdcod_').asstring:=fieldbyname('prdcod').asstring;
> if fieldbyname('stkid').asstring='el' then
> parambyname('el_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='sl' then
> parambyname('sl_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='bo' then
> parambyname('bo_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='hn' then
> parambyname('hn_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger;
> // end;
>
> with query2 do
> begin
> parambyname('prdcod_').asstring:=fieldbyname('prdcod').asstring;
> if fieldbyname('stkid').asstring='el' then
> parambyname('el_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='sl' then
> parambyname('sl_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='bo' then
> parambyname('bo_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger
> else
> if fieldbyname('stkid').asstring='hn' then
> parambyname('hn_').asinteger:=fieldbyname('trans').asinteger + fieldbyname('netinp').asinteger;
> // end;
> close;
> sql.add('insert into bmt750t (prdcod,up2,el,sl,bo,hn)');
> sql.add('values (:prdcod_,,:el_,:sl_,:bo_,:hn_)');
> execsql;
> close;
> end;//with
> next;
> end;//while
> end;//with
>
> with query1 do
> begin
> i:=0;
> close;
> sql.clear;
> sql.add('select prdcod,up2,el,sl,bo,hn');
> sql.add('from bmt750t');
> open;
> first;
> i:=1;
> stringgrid1.rowcount:=recordcount+1;
> while not eof do
> begin
> stringgrid1.cells[0,i]:=fieldbyname('prdcod').asstring;
> stringgrid1.cells[1,i]:=fieldbyname('up2').asstring;
> stringgrid1.cells[2,i]:=fieldbyname('el').asstring;
> stringgrid1.cells[3,i]:=fieldbyname('sl').asstring;
> stringgrid1.cells[4,i]:=fieldbyname('bo').asstring;
> stringgrid1.cells[5,i]:=fieldbyname('hn').asstring;
> next;
> inc(i);
> end;//while
> close; //query1
>
> sql.clear;
> sql.add('drop table bmt750t');
> execsql;
> close;
> end; //with
>
> end; //처음 begin
>
>