OdbcDataReader.RecordsAffected Property

Definition

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

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

Property Value

Int32

更改、插入或删除的行数。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.

Implements

Remarks

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

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

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

Applies to

See also