DbDataReader.RecordsAffected Property

Definition

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

Property Value

The number of rows changed, inserted, or deleted. -1 for SELECT statements; 0 if no rows were affected or the statement failed.

Implements

Remarks

The RecordsAffected property is not set until all rows are read and you close the DataReader.

Notes to Implementers

This property and IsClosed should be implemented to return a value when the reader is closed.

Applies to

See also