OracleRowUpdatedEventArgs クラス

定義

RowUpdated イベントのデータを提供します。 このクラスは継承できません。

public ref class OracleRowUpdatedEventArgs sealed : System::Data::Common::RowUpdatedEventArgs
public sealed class OracleRowUpdatedEventArgs : System.Data.Common.RowUpdatedEventArgs
type OracleRowUpdatedEventArgs = class
    inherit RowUpdatedEventArgs
Public NotInheritable Class OracleRowUpdatedEventArgs
Inherits RowUpdatedEventArgs
継承
OracleRowUpdatedEventArgs

次の例は、 RowUpdating イベントと RowUpdated イベントの両方を使用する方法を示しています。

RowUpdating イベントは、次の出力を返します。

Event Arguments: (command=OracleCommand commandType=2status=0)

RowUpdated イベントは、次の出力を返します。

Event Arguments: (command= OracleCommend commandType=2 recordsAffected=1 row=System.Data.DataRow[37] status=0)

// handler for RowUpdating event
 private static void OnRowUpdating(object sender, OracleRowUpdatingEventArgs e) {
    PrintEventArgs(e);
 }

 //Handler for RowUpdated event.
 private static void OnRowUpdated(object sender, OracleRowUpdatedEventArgs e) {
    PrintEventArgs(e);
 }

 public static int Main(String[] args) {
    const string CONNECTION_STRING = "Data Source=Oracle8i;Integrated Security=yes";
    const string SELECT_ALL = "SELECT * FROM Scott.Emp";

    //Create DataAdapter.
    OracleDataAdapter rAdapter = new OracleDataAdapter(SELECT_ALL, CONNECTION_STRING);
    OracleCommandBuilder cb = new OracleCommandBuilder(rAdapter);

    //Create and fill DataSet (Select only first 5 rows.).
    DataSet rDataSet = new DataSet();
    rAdapter.Fill(rDataSet, 0, 5, "Table");

    //Modify DataSet.
    DataTable rTable = rDataSet.Tables["Table"];
    rTable.Rows[0][1] = "DYZY";

    //Add handlers.
    rAdapter.RowUpdating += new OracleRowUpdatingEventHandler( OnRowUpdating );
    rAdapter.RowUpdated += new OracleRowUpdatedEventHandler( OnRowUpdated );

    //Update--this operation fires two events (RowUpdating and RowUpdated) for each changed row.
    rAdapter.Update(rDataSet, "Table");

    //Remove handlers.
    rAdapter.RowUpdating -= new OracleRowUpdatingEventHandler( OnRowUpdating );
    rAdapter.RowUpdated -= new OracleRowUpdatedEventHandler( OnRowUpdated );
    return 0;
 }

 private static void PrintEventArgs(OracleRowUpdatingEventArgs args) {
    Console.WriteLine("OnRowUpdating");
    Console.WriteLine("  event args: ("+
           " command=" + args.Command +
           " commandType=" + args.StatementType +
           " status=" + args.Status + ")");
 }

 private static void PrintEventArgs(OracleRowUpdatedEventArgs args) {
    Console.WriteLine("OnRowUpdated");
    Console.WriteLine( "  event args: ("+
           " command=" + args.Command +
           " commandType=" + args.StatementType +
           " recordsAffected=" + args.RecordsAffected +
           " status=" + args.Status + ")" );
 }
    'Handler for RowUpdating event.
    Private Shared Sub OnRowUpdating(sender As Object, e As OracleRowUpdatingEventArgs)
        PrintEventArgs(e)
    End Sub

    'Handler for RowUpdated event.
    Private Shared Sub OnRowUpdated(sender As Object, e As OracleRowUpdatedEventArgs)
        PrintEventArgs(e)
    End Sub
    
    'Entry point which delegates to C-style main Private Function.
    Public Overloads Shared Sub Main()
        System.Environment.ExitCode = Main(System.Environment.GetCommandLineArgs())
    End Sub
    
    Overloads Public Shared Function Main(args() As String) As Integer
        Const CONNECTION_STRING As String = "Data Source=Oracle8i;Integrated Security=yes"
        Const SELECT_ALL As String = "SELECT * FROM Scott.Emp"
        
        'Create DataAdapter.
        Dim rAdapter As New OracleDataAdapter(SELECT_ALL, CONNECTION_STRING)
        Dim cb As New OracleCommandBuilder(rAdapter)
        
        'Create and fill DataSet (Select only first 5 rows.).
        Dim rDataSet As New DataSet()
        rAdapter.Fill(rDataSet, 0, 5, "Table")
        
        'Modify DataSet.
        Dim rTable As DataTable = rDataSet.Tables("Table")
        rTable.Rows(0)(1) = "DYZY"
        
        'Add handlers.
        AddHandler rAdapter.RowUpdating, AddressOf OnRowUpdating
        AddHandler rAdapter.RowUpdated, AddressOf OnRowUpdated
        
        'Update--this operation fires two events (RowUpdating and RowUpdated) for each changed row.
        rAdapter.Update(rDataSet, "Table")
        
        'Remove handlers.
        RemoveHandler rAdapter.RowUpdating, AddressOf OnRowUpdating
        RemoveHandler rAdapter.RowUpdated, AddressOf OnRowUpdated
        Return 0
    End Function 'Main
    
    
    Overloads Private Shared Sub PrintEventArgs(args As OracleRowUpdatingEventArgs)
        Console.WriteLine("OnRowUpdating")
        Console.WriteLine("  event args: (" & " command=" & args.Command.CommandText & _
                        " commandType=" & args.StatementType & " status=" & args.Status & ")")
    End Sub
    
    
    Overloads Private Shared Sub PrintEventArgs(args As OracleRowUpdatedEventArgs)
        Console.WriteLine("OnRowUpdated")
        Console.WriteLine("  event args: (" & " command=" & args.Command.CommandText & _
                        " commandType=" & args.StatementType & " recordsAffected=" & _
                        args.RecordsAffected & " status=" & args.Status & ")")
    End Sub
End Class

注釈

RowUpdated イベントは、行へのUpdateが完了したときに発生します。

Updateを使用する場合、更新されたデータ行ごとに 2 つのイベントが発生します。 実行の順序は次のとおりです。

  1. DataRow内の値はパラメーター値に移動されます。

  2. OnRowUpdating イベントが発生します。

  3. コマンドが実行されます。

  4. コマンドが FirstReturnedRecordに設定されている場合、最初に返された結果が DataRowに配置されます。

  5. 出力パラメーターがある場合は、DataRowに配置されます。

  6. OnRowUpdated イベントが発生します。

  7. AcceptChanges が呼び出されます

コンストラクター

名前 説明
OracleRowUpdatedEventArgs(DataRow, IDbCommand, StatementType, DataTableMapping)

OracleRowUpdatedEventArgs クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
Command

OracleCommandが呼び出されたときに実行されるUpdate(DataSet)を取得または設定します。

Errors

Commandの実行時に.NET データ プロバイダーによって生成されたエラーを取得します。

(継承元 RowUpdatedEventArgs)
RecordsAffected

SQL ステートメントの実行によって変更、挿入、または削除された行の数を取得します。

(継承元 RowUpdatedEventArgs)
Row

DataRowを介して送信されたUpdate(DataSet)を取得します。

(継承元 RowUpdatedEventArgs)
RowCount

更新されたレコードのバッチで処理される行の数を取得します。

(継承元 RowUpdatedEventArgs)
StatementType

実行される SQL ステートメントの型を取得します。

(継承元 RowUpdatedEventArgs)
Status

UpdateStatus プロパティのCommandを取得します。

(継承元 RowUpdatedEventArgs)
TableMapping

DataTableMappingを介して送信されたUpdate(DataSet)を取得します。

(継承元 RowUpdatedEventArgs)

メソッド

名前 説明
CopyToRows(DataRow[], Int32)

指定された配列に変更された行への参照をコピーします。

(継承元 RowUpdatedEventArgs)
CopyToRows(DataRow[])

指定された配列に変更された行への参照をコピーします。

(継承元 RowUpdatedEventArgs)
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象