DbDataReader.RecordsAffected DbDataReader.RecordsAffected DbDataReader.RecordsAffected DbDataReader.RecordsAffected Property

定义

当在派生类中重写时,获取通过执行 SQL 语句而更改、插入或删除的行数。When overridden in a derived class, gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

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

属性值

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

实现

注解

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

继承者说明

应实现此IsClosed属性,以便在读取器关闭时返回值。This property and IsClosed should be implemented to return a value when the reader is closed.

适用于

另请参阅