修改数据库

1、当修改数据库表中的状态、标识字段时, where条件加上原来状态、标识的值

     update user set state=1 where id=123 and state='oldstate'

这样可以通过返回值,来判断修改的记录数,如果记录数==预计的记录数, 则表示更新成功, 否则更新失败

猜你喜欢

转载自wanxiaotao12-126-com.iteye.com/blog/1872125