SqlRowUpdatingEventArgs クラス
アセンブリ: System.Data (system.data.dll 内)



RowUpdating イベントと RowUpdated イベントを使用する方法を次の例に示します。
イベント引数 : (command=System.Data.SqlClient.SQLCommand commandType=2 status=0)
イベント引数 : (command=System.Data.SqlClient.SQLCommand commandType=2 recordsAffected=1 row=System.Data.DataRow[37] status=0)
'Handler for RowUpdating event. Private Shared Sub OnRowUpdating(sender As Object, e As SqlRowUpdatingEventArgs) PrintEventArgs(e) End Sub 'Handler for RowUpdated event. Private Shared Sub OnRowUpdated(sender As Object, e As SqlRowUpdatedEventArgs) 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 = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer" Const SELECT_ALL As String = "select * from Products" 'Create DataAdapter. Dim rAdapter As New SqlDataAdapter(SELECT_ALL, CONNECTION_STRING) '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) = "new product" '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 Overloads Private Shared Sub PrintEventArgs(args As SqlRowUpdatingEventArgs) 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 SqlRowUpdatedEventArgs) Console.WriteLine("OnRowUpdated") Console.WriteLine(" event args: (" & _ " command=" & _ args.Command.CommandText & _ " commandType=" & _ args.StatementType & _ " recordsAffected=" & _ args.RecordsAffected & _ " status=" & _ args.Status & _ ")") End Sub
// handler for RowUpdating event private static void OnRowUpdating(object sender, SqlRowUpdatingEventArgs e) { PrintEventArgs(e); } //Handler for RowUpdated event. private static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs e) { PrintEventArgs(e); } public static int Main() { const string CONNECTION_STRING = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer"; const string SELECT_ALL = "select * from Products"; //Create DataAdapter. SqlDataAdapter rAdapter = new SqlDataAdapter(SELECT_ALL, CONNECTION_STRING); //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] = "new product"; //Add handlers. rAdapter.RowUpdating += new SqlRowUpdatingEventHandler( OnRowUpdating ); rAdapter.RowUpdated += new SqlRowUpdatedEventHandler( OnRowUpdated ); //Update--this operation fires two events (RowUpdating and RowUpdated) for each changed row. rAdapter.Update(rDataSet, "Table"); //Remove handlers. rAdapter.RowUpdating -= new SqlRowUpdatingEventHandler( OnRowUpdating ); rAdapter.RowUpdated -= new SqlRowUpdatedEventHandler( OnRowUpdated ); return 0; } private static void PrintEventArgs(SqlRowUpdatingEventArgs args) { Console.WriteLine("OnRowUpdating"); Console.WriteLine(" event args: ("+ " command=" + args.Command + " commandType=" + args.StatementType + " status=" + args.Status + ")"); } private static void PrintEventArgs(SqlRowUpdatedEventArgs args) { Console.WriteLine("OnRowUpdated"); Console.WriteLine(" event args: ("+ " command=" + args.Command + " commandType=" + args.StatementType + " recordsAffected=" + args.RecordsAffected + " status=" + args.Status + ")"); }

System.EventArgs
System.Data.Common.RowUpdatingEventArgs
System.Data.SqlClient.SqlRowUpdatingEventArgs


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SqlRowUpdatingEventArgs コンストラクタ
アセンブリ: System.Data (system.data.dll 内)

Public Sub New ( _ row As DataRow, _ command As IDbCommand, _ statementType As StatementType, _ tableMapping As DataTableMapping _ )
Dim row As DataRow Dim command As IDbCommand Dim statementType As StatementType Dim tableMapping As DataTableMapping Dim instance As New SqlRowUpdatingEventArgs(row, command, statementType, tableMapping)
public SqlRowUpdatingEventArgs ( DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping )
public: SqlRowUpdatingEventArgs ( DataRow^ row, IDbCommand^ command, StatementType statementType, DataTableMapping^ tableMapping )
public SqlRowUpdatingEventArgs ( DataRow row, IDbCommand command, StatementType statementType, DataTableMapping tableMapping )
public function SqlRowUpdatingEventArgs ( row : DataRow, command : IDbCommand, statementType : StatementType, tableMapping : DataTableMapping )

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SqlRowUpdatingEventArgs プロパティ

名前 | 説明 | |
---|---|---|
![]() | Errors | Command の実行時に .NET Framework データ プロバイダが生成したエラーを取得します。 ( RowUpdatingEventArgs から継承されます。) |
![]() | Row | 挿入、更新、または削除操作の一部としてサーバーに送信される DataRow を取得します。 ( RowUpdatingEventArgs から継承されます。) |
![]() | StatementType | 実行する SQL ステートメントの種類を取得します。 ( RowUpdatingEventArgs から継承されます。) |
![]() | Status | Command プロパティの UpdateStatus を取得または設定します。 ( RowUpdatingEventArgs から継承されます。) |
![]() | TableMapping | Update を通じて送信する DataTableMapping を取得します。 ( RowUpdatingEventArgs から継承されます。) |


SqlRowUpdatingEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

SqlRowUpdatingEventArgs メンバ
SqlRowUpdatingEventArgs データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Errors | Command の実行時に .NET Framework データ プロバイダが生成したエラーを取得します。(RowUpdatingEventArgs から継承されます。) |
![]() | Row | 挿入、更新、または削除操作の一部としてサーバーに送信される DataRow を取得します。(RowUpdatingEventArgs から継承されます。) |
![]() | StatementType | 実行する SQL ステートメントの種類を取得します。(RowUpdatingEventArgs から継承されます。) |
![]() | Status | Command プロパティの UpdateStatus を取得または設定します。(RowUpdatingEventArgs から継承されます。) |
![]() | TableMapping | Update を通じて送信する DataTableMapping を取得します。(RowUpdatingEventArgs から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- SqlRowUpdatingEventArgsのページへのリンク