2007调试的代码 huohao:=strtoint(edit1.Text); kuchun:=strtoint(edit2.Text); huanhuoshuliang:=strtoint(edit3.Text); newkuchun:=kuchun-huanhuoshuliang; if newkuchun >= 0 then begin adocommand1.ConnectionString:=abc; adocommand1.CommandText:='update 入库 set 库存=:newkuchun where 货号=:货号'; adocommand1.Parameters.ParamByName('newkuchun').Value:=newkuchun; adocommand1.Parameters.ParamByName('货号').Value:=huohao; adocommand1.CommandType:=cmdtext; adocommand1.Execute; messagebox(0,pchar('记录已经成功修改!'),pchar('恭喜'),0); 跟7里面的一样,只有几个edit变了。
adocommand1.ConnectionString:=constr;
adocommand1.CommandText:='update 入库 set 库存=:newkuchun where 货号=:货号';
adocommand1.Parameters.ParamByName('newkuchun').Value:=newkuchun;
adocommand1.Parameters.ParamByName('货号').Value:=huohao;
adocommand1.CommandType:=cmdtext;
adocommand1.Execute;
messagebox(0,pchar('记录已经成功修改!'),pchar('恭喜'),0);
代码好像也看不出有什么问题,主要是可以运行,也提示 成功修改,可数据库里就是没有更新数值。
huohao这个变量的值也的确是变成了想要的正确值,再往下也能正常运行完。可数据库里的还是没更新,真是头大。 有那位高手能不能看出问题在那儿啊。我是没没办法了。
货号=:货号 货号=货号
kuchun:=strtoint(edit2.Text);
huanhuoshuliang:=strtoint(edit3.Text);
newkuchun:=kuchun-huanhuoshuliang;
if newkuchun >= 0 then
begin
adocommand1.ConnectionString:=abc;
adocommand1.CommandText:='update 入库 set 库存=:newkuchun where 货号=:货号';
adocommand1.Parameters.ParamByName('newkuchun').Value:=newkuchun;
adocommand1.Parameters.ParamByName('货号').Value:=huohao;
adocommand1.CommandType:=cmdtext;
adocommand1.Execute;
messagebox(0,pchar('记录已经成功修改!'),pchar('恭喜'),0);
跟7里面的一样,只有几个edit变了。