当前位置:编程学习 > Delphi >>

100分求解一个delphi里关于adoquery的update问题

procedure TForm1.Button8Click(Sender: TObject); begin adoquery1.Close; adoquery1.SQL.Clear; adoquery1.SQL.Add('update dljd set 序号=:xuhao and 点位X=:pointx and 点位Y=:pointy and 分析符=:anlyse '); adoquery1.Open; adoquery1.Parameters.ParamByName('xuhao').value:=inttostr(288); adoquery1.Parameters.ParamByName('pointx').Value:=inttostr(12453); adoquery1.Parameters.ParamByName('pointy').Value:=inttostr(12453); adoquery1.Parameters.ParamByName('anlyse').Value:=inttostr(1); adoquery1.ExecSQL; end; 错误提示:至少一个参数没有被指定值
追问:只有四个字段。一开始我写了一段添加记录的代码,成功的。可是在写update失败后,现在连添加记录时也出现这个问题了调试了。。。在adoquery1.Parameters.ParamByName('xuhao').value:=inttostr(288);到这一步就报错了。跳出“至少一个参数没有被指定值”你QQ多少?加你QQ,远程帮我看看。
答案:检查dljd 到底几个字段
其他:1,adoquery1.SQL.Add('update dljd set  序号=:xuhao and  点位X=:pointx and 点位Y=:pointy and 分析符=:anlyse ');
update不是这样用的吧,把and改成逗号
adoquery1.SQL.Add('update dljd set  序号=:xuhao , 点位X=:pointx , 点位Y=:pointy , 分析符=:anlyse '); 
你用了and,最终你只修改了第一个字段,即使序号,and是逻辑运算符,基本上你所有序号都是0了
2,最主要的错误是多了一个adoquery1.Open;,把这个删了,你在给参数赋值之前就OPEN了。 wqewq adoquery1.Open; 应该放在Parameters之后使用. 

上一个:请问delphi中 strShowTable:='#Show'; strRecordTable:='#Record';其中#Show和#Record表示什么意思?
下一个:delphi过滤字符串

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,