IDataReader.RecordsAffected IDataReader.RecordsAffected IDataReader.RecordsAffected IDataReader.RecordsAffected Property

定义

通过执行 SQL 语句获取更改、插入或删除的行数。Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

public:
 property int RecordsAffected { int get(); };
public int RecordsAffected { get; }
member this.RecordsAffected : int
Public ReadOnly Property RecordsAffected As Integer

属性值

已更改、插入或删除的行数;如果没有受影响的行或语句失败,则为 0;对于 SELECT 语句为 -1。The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.

注解

RecordsAffected读取所有行并IDataReader关闭之前, 不会设置属性。The RecordsAffected property is not set until all rows are read and you close the IDataReader.

IsClosedRecordsAffected是在关闭后可调用的IDataReader唯一属性。IsClosed and RecordsAffected are the only properties that you can call after the IDataReader is closed.

适用于