阅读背景:

在数据库操作(插入,更新,删除)过度杀伤后检查受影响的行是否计数?

来源:互联网 

Lately in apps I've been developing I have been checking the number of rows affected by an insert, update, delete to the database and logging an an error if the number is unexpected. For example on a simple insert, update, or delete of one row if any number of rows other than one is returned from an ExecuteNonQuery() call, I will consider that an error and log it. Also, I realize now as I type this that I do not even try to rollback the transaction if that happens, which is not the best practice and should definitely be addressed. Anyways, here's code to illustrate what I mean:Lately in apps I've been developing I have been




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: