delphi调试出 qry1:parameter'y_10'not found 帮忙看看
w1,w2是listbox,qry1是query1,DBgrd1是DBgrid1;procedureTForm1.dbgrd1CellClick(Column:TColu...
w1,w2是listbox, qry1是query1,DBgrd1是DBgrid1;
procedure TForm1.dbgrd1CellClick(Column: TColumn);
var
s: array[1..10]of string;
i:Integer;
begin
w2.Items.Clear;
edt1.Text:='';
edt1.Text:=qry1.FieldValues['y_01'];
s[1] := Qry1.FieldValues['y_02'] ;
s[2] := Qry1.FieldValues['y_03'];
s[3] := Qry1.FieldValues['y_04'];
s[4] := Qry1.FieldValues['y_05'];
s[5] := Qry1.FieldValues['y_06'];
s[6] := Qry1.FieldValues['y_07'];
s[7] := Qry1.FieldValues['y_08'];
s[8] := Qry1.FieldValues['y_09'];
s[9] := Qry1.FieldValues['y_10'];
for i:=1 to 9 do
begin
w2.Items.Add(s[i]);
end;
btn1.Enabled:=False;
btn4.Enabled:=true;
end;
procedure TForm1.btn4Click(Sender: TObject);
var
sqlstr:string;
begin
sqlstr:='update yang_6.db set Y_01=:Y_01,'+'Y_02=:Y_02,Y_03=:Y_03,'+'Y_04=:Y_04,Y_05=:Y_05,'+'Y_06=:Y_06,Y_07=:Y_07,'+'Y_08=:Y_08,Y_09=:Y_09,Y_10=:Y_10'+'where Y_01=:oldedt';
with qry1 do
begin
Close;
SQL.Clear;
SQL.Add(sqlstr);
ParamByName('Y_01').AsString:=edt1.Text;
ParamByName('Y_02').AsString:=w2.Items.Strings[0];
ParamByName('Y_03').AsString:=w2.Items.Strings[1];
ParamByName('Y_04').AsString:=w2.Items.Strings[2];
ParamByName('Y_05').AsString:=w2.Items.Strings[3];
ParamByName('Y_06').AsString:=w2.Items.Strings[4];
ParamByName('Y_07').AsString:=w2.Items.Strings[5];
ParamByName('Y_08').AsString:=w2.Items.Strings[6];
ParamByName('Y_09').AsString:=w2.Items.Strings[7];
ParamByName('Y_10').AsString:=w2.Items.Strings[8];
ParamByName('oldedt').AsString:=oldedt;
ExecSQL;
display;
end; 展开
procedure TForm1.dbgrd1CellClick(Column: TColumn);
var
s: array[1..10]of string;
i:Integer;
begin
w2.Items.Clear;
edt1.Text:='';
edt1.Text:=qry1.FieldValues['y_01'];
s[1] := Qry1.FieldValues['y_02'] ;
s[2] := Qry1.FieldValues['y_03'];
s[3] := Qry1.FieldValues['y_04'];
s[4] := Qry1.FieldValues['y_05'];
s[5] := Qry1.FieldValues['y_06'];
s[6] := Qry1.FieldValues['y_07'];
s[7] := Qry1.FieldValues['y_08'];
s[8] := Qry1.FieldValues['y_09'];
s[9] := Qry1.FieldValues['y_10'];
for i:=1 to 9 do
begin
w2.Items.Add(s[i]);
end;
btn1.Enabled:=False;
btn4.Enabled:=true;
end;
procedure TForm1.btn4Click(Sender: TObject);
var
sqlstr:string;
begin
sqlstr:='update yang_6.db set Y_01=:Y_01,'+'Y_02=:Y_02,Y_03=:Y_03,'+'Y_04=:Y_04,Y_05=:Y_05,'+'Y_06=:Y_06,Y_07=:Y_07,'+'Y_08=:Y_08,Y_09=:Y_09,Y_10=:Y_10'+'where Y_01=:oldedt';
with qry1 do
begin
Close;
SQL.Clear;
SQL.Add(sqlstr);
ParamByName('Y_01').AsString:=edt1.Text;
ParamByName('Y_02').AsString:=w2.Items.Strings[0];
ParamByName('Y_03').AsString:=w2.Items.Strings[1];
ParamByName('Y_04').AsString:=w2.Items.Strings[2];
ParamByName('Y_05').AsString:=w2.Items.Strings[3];
ParamByName('Y_06').AsString:=w2.Items.Strings[4];
ParamByName('Y_07').AsString:=w2.Items.Strings[5];
ParamByName('Y_08').AsString:=w2.Items.Strings[6];
ParamByName('Y_09').AsString:=w2.Items.Strings[7];
ParamByName('Y_10').AsString:=w2.Items.Strings[8];
ParamByName('oldedt').AsString:=oldedt;
ExecSQL;
display;
end; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询