J
jackson_wu
Unregistered / Unconfirmed
GUEST, unregistred user!
ADOQuery1数据集内容<br>code bumo sl Field<br>0001 A 100 PV1<br>0001 A 100 PV20<br>以下程序实现的功能是:取出ADOQuery1中每一行数据对ADOQuery2进行更新<br>报错:不正常地定义参数对象,提供了不一致或不完整的信息.<br>是不是因为'update xseik set :strField=:sl 这一句的问题啊<br> ADOQuery2.SQL.Add('update xseik set :strField=:sl where CODE=:strcode and '+' bumo=:strbumo and skubu =0 and fixlevel=1 ');<br><br><br>procedure TFrmSeikRecovery.Button2Click(Sender: TObject);<br>var<br> strcode,strbumo,strField:string;<br> sl:double;<br>begin<br> ADOQuery1.First;<br> while not ADOQuery1.Eof do<br> begin<br> strcode:=ADOQuery1.Fields[0].Value;<br> strbumo:=ADOQuery1.Fields[1].Value;<br> sl:=ADOQuery1.Fields[2].Value;<br> strField:=ADOQuery1.Fields[4].Value;<br> ADOQuery2.Parameters.ParamByName('strcode').Value:=strcode;<br> ADOQuery2.Parameters.ParamByName('strbumo').Value:=strbumo;<br> ADOQuery2.Parameters.ParamByName('sl').Value:=sl;<br> ADOQuery2.Parameters.ParamByName('strField').Value:=strField;<br> ADOQuery2.Close;<br> ADOQuery2.SQL.Clear;<br> ADOQuery2.SQL.Add('update xseik set :strField=:sl where CODE=:strcode and '+' bumo=:strbumo and skubu =0 and fixlevel=1 ');<br> try<br> ADOQuery2.ExecSQL;<br> except<br> showmessage('连接数据库失败!!!!');<br> end;<br> //showmessage(floattostr(sl));<br> ADOQuery1.Next;<br> end;<br>end;