我的程序:
        adoconnection1.open;
        adoquery1.Close;
        adoquery1.SQL.Clear;
        adoquery1.SQL.Add('update zbase_dianhuahaoma set dianhuahaoma =:phone, yonghu =:user, dizhi =:address where dianhuahaoma =:dianhuahaoma');
        adoquery1.Parameters.ParamByName('phone').Value := trim(phone);
        adoquery1.Parameters.ParamByName('user').Value := trim(user);
        adoquery1.Parameters.ParamByName('address').Value := trim(address);
        adoquery1.Parameters.ParamByName('dianhuahaoma').Value := trim(phone);
        adoquery1.ExecSQL;
可为什么不能更新。没有报错。

解决方案 »

  1.   

    请确认 trim(phone)得到预期的在值 否则where子句找不到更新的记录
      

  2.   

    有没有COMMIT;adoquery1.CommitUpdates;
      

  3.   

    我用showmessage(phone)看了,得到的是预期的值
    adoquery1.CommitUpdates;报错,Adoquery没有这个方法吧。
      

  4.   

    adoquery1.SQL.Add('update zbase_dianhuahaoma set dianhuahaoma =:phone, yonghu =:user, dizhi =:address where dianhuahaoma =:dianhuahaoma');句中的"="和":"之间有空格吗,应该要加入空格的
      

  5.   

    实在不行的话,在SQL语句中加入Commit
        adoquery1.SQL.Add('update zbase_dianhuahaoma set dianhuahaoma =:phone, yonghu =:user, dizhi =:address where dianhuahaoma =:dianhuahaoma; commit;');
      

  6.   

    看看自己的数据库,有没有不符合字段定义的数据!比如phone是char(13),但是出现一个数据是12位,这样你修改数据库时是不能实现的吧!
      

  7.   

    Oracle必须commit后才能看到数据库更新,你只update是无法看到纪录被更新的。当然你也没有必要每update一次就commit,可以update100条或1000条后commit一下,这个有自己决定。