OleDbDataReader.RecordsAffected 属性

定义

通过执行 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读取所有行并OleDbDataReader关闭之前,不会设置属性。The RecordsAffected property is not set until all rows are read and you close the OleDbDataReader.

此属性的值为累积值。The value of this property is cumulative. 例如,如果将两个记录插入批处理模式,则的值RecordsAffected为2。For example, if two records are inserted in batch mode, the value of RecordsAffected is two.

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

适用于

另请参阅