Mimer Data Provider

MimerDataReader.RecordsAffected Property

Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

[Visual Basic]
Public Property ReadOnly RecordsAffected As Integer _
    Implements IDataReader.RecordsAffected
[C#]
public int RecordsAffected { get; }
[C++]
public: __property int get_RecordsAffected();
[JScript]
public function get RecordsAffected() : int

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

IDataReader.RecordsAffected

Remarks

For multisql statements this property returns the accumulated number of rows affected by all statements, see example below.

Example

[C#]
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
[Visual Basic]
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

[C++, JScript] 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.

See Also

MimerDataReader Class | Mimer.Data.Client Namespace