Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Syntax
'Declaration
Public Overrides NotOverridable ReadOnly Property RecordsAffected As Integer
public override int RecordsAffected {get;}
public read-only property RecordsAffected: Integer; override;
public override function get RecordsAffected : int
public: __property int get_RecordsAffected() override;
Property Value
The number of rows changed, inserted, or deleted. -1 for select statements; 0 if no rows were affected, or the statement failed.
Example
No example is available for C++ or JScript. To view a C# example, click the Language Filter button in the upper-left corner of the page.
MimerCommand command = new MimerCommand();
command.Connection = conn1;
//
// Perform inserts into tables TAB1 and TAB2 in one call
//
command.CommandText = "INSERT INTO TAB1 VALUES(1,'Strong');INSERT INTO TAB2 VALUES(1,DATE '2001-12-31')";
MimerDataReader reader = command.ExecuteReader();
Console.WriteLine("Number of rows affected: " + reader.RecordsAffected.ToString());
The above code will display:
Number of rows affected: 2
Dim command As New MimerCommand()
command.Connection = conn1
'
' Perform inserts into tables TAB1 and TAB2 in one call
'
command.CommandText = "INSERT INTO TAB1 VALUES(1,'Strong');INSERT INTO TAB2 VALUES(1,DATE '2001-12-31')"
Dim reader as MimerDataReader
reader = command.ExecuteReader()
Console.WriteLine("Number of rows affected: " & reader.RecordsAffected.ToString())
The above code will display:
Number of rows affected: 2
Requirements
.NET Framework
Version 2.0 or later
See Also