且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ExecuteNonQuery()返回受影响的C#的意外行数

更新时间:2023-02-07 18:39:32

对于UPDATE,INSERT和DELETE语句,返回值是受命令影响的行数.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

当要插入或更新的表上存在触发器时,返回值包括受插入或更新操作影响的行数以及受一个或多个触发器影响的行数.对于所有其他类型的语句,返回值为-1.如果发生回滚,则返回值为-1.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.