SqlRowUpdatedEventArgsとは? わかりやすく解説

SqlRowUpdatedEventArgs クラス

RowUpdated イベントデータ提供します

名前空間: System.Data.SqlClient
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public NotInheritable Class
 SqlRowUpdatedEventArgs
    Inherits RowUpdatedEventArgs
Dim instance As SqlRowUpdatedEventArgs
public sealed class SqlRowUpdatedEventArgs
 : RowUpdatedEventArgs
public ref class SqlRowUpdatedEventArgs sealed
 : public RowUpdatedEventArgs
public final class SqlRowUpdatedEventArgs extends
 RowUpdatedEventArgs
public final class SqlRowUpdatedEventArgs extends
 RowUpdatedEventArgs
解説解説
使用例使用例

RowUpdating イベントRowUpdated イベント使用する方法次の例に示します

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

イベント引数 : (command=System.Data.SqlClient.SqlCommand commandType=2 status=0)

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

イベント引数 : (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 connectionString As String
 = _
            "Integrated Security=SSPI;database=Northwind;server=MSSQL1"
        Const queryString As String
 = "SELECT * FROMProducts"
        
        ' create DataAdapter
        Dim adapter As New
 SqlDataAdapter(queryString, connectionString)
        Dim builder As SqlCommandBuilder =
 New SqlCommandBuilder(adapter)
        
        ' Create and fill DataSet (select only first 5 rows)
        Dim dataSet As New
 DataSet()
        adapter.Fill(dataSet, 0, 5, "Table")
        
        ' Modify DataSet
        Dim table As DataTable = dataSet.Tables("Table")
        table.Rows(0)(1) = "new product"
        
        ' add handlers
        AddHandler adapter.RowUpdating, AddressOf
 OnRowUpdating
        AddHandler adapter.RowUpdated, AddressOf
 OnRowUpdated
        
        ' update, this operation fires two events 
        '(RowUpdating/RowUpdated) per changed row 
        adapter.Update(dataSet, "Table")
        
        ' remove handlers
        RemoveHandler adapter.RowUpdating, AddressOf
 OnRowUpdating
        RemoveHandler adapter.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 
End Class 
// 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 connectionString = 
              "Integrated Security=SSPI;database=Northwind;server=MSSQL1";
    const string queryString = "SELECT
 * FROMProducts";
 
    // create DataAdapter
    SqlDataAdapter adapter = new SqlDataAdapter(queryString, connectionString);
    SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
 
    // Create and fill DataSet (select only first 5 rows)
    DataSet dataSet = new DataSet();
    adapter.Fill(dataSet, 0, 5, "Table");
 
    // Modify DataSet
    DataTable table = dataSet.Tables["Table"];
    table.Rows[0][1] = "new product";
 
    // add handlers
    adapter.RowUpdating += new SqlRowUpdatingEventHandler( OnRowUpdating
 );
    adapter.RowUpdated += new SqlRowUpdatedEventHandler( OnRowUpdated
 );
 
    // update, this operation fires two events 
    // (RowUpdating/RowUpdated) per changed row 
    adapter.Update(dataSet, "Table");
 
    // remove handlers
    adapter.RowUpdating -= new SqlRowUpdatingEventHandler( OnRowUpdating
 );
    adapter.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.Object
   System.EventArgs
     System.Data.Common.RowUpdatedEventArgs
      System.Data.SqlClient.SqlRowUpdatedEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlRowUpdatedEventArgs メンバ
System.Data.SqlClient 名前空間

SqlRowUpdatedEventArgs コンストラクタ

SqlRowUpdatedEventArgs クラス新しインスタンス初期化します。

名前空間: System.Data.SqlClient
アセンブリ: 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 SqlRowUpdatedEventArgs(row,
 command, statementType, tableMapping)
public SqlRowUpdatedEventArgs (
    DataRow row,
    IDbCommand command,
    StatementType statementType,
    DataTableMapping tableMapping
)
public:
SqlRowUpdatedEventArgs (
    DataRow^ row, 
    IDbCommand^ command, 
    StatementType statementType, 
    DataTableMapping^ tableMapping
)
public SqlRowUpdatedEventArgs (
    DataRow row, 
    IDbCommand command, 
    StatementType statementType, 
    DataTableMapping tableMapping
)
public function SqlRowUpdatedEventArgs (
    row : DataRow, 
    command : IDbCommand, 
    statementType : StatementType, 
    tableMapping : DataTableMapping
)

パラメータ

row

Update通じて送信された DataRow。

command

Update呼び出し時に実行される IDbCommand。

statementType

実行されクエリ種類指定する StatementType 値の 1 つ

tableMapping

Update通じて送信された DataTableMapping。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlRowUpdatedEventArgs クラス
SqlRowUpdatedEventArgs メンバ
System.Data.SqlClient 名前空間

SqlRowUpdatedEventArgs プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Errors  Command実行時.NET Framework データ プロバイダ生成したエラー取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ RecordsAffected  SQL ステートメントによって変更挿入、または削除された行の数を取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ Row  Update通じて送信された DataRow を取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ RowCount  バッチでの更新済みレコード処理された行数を取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ StatementType  実行されSQL ステートメント種類取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ Status  Command プロパティの UpdateStatus を取得します。 ( RowUpdatedEventArgs から継承されます。)
パブリック プロパティ TableMapping  Update通じて送信された DataTableMapping を取得します。 ( RowUpdatedEventArgs から継承されます。)
参照参照

関連項目

SqlRowUpdatedEventArgs クラス
System.Data.SqlClient 名前空間

SqlRowUpdatedEventArgs メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SqlRowUpdatedEventArgs クラス
System.Data.SqlClient 名前空間

SqlRowUpdatedEventArgs メンバ

RowUpdated イベントデータ提供します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド SqlRowUpdatedEventArgs SqlRowUpdatedEventArgs クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Errors  Command実行時.NET Framework データ プロバイダ生成したエラー取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ RecordsAffected  SQL ステートメントによって変更挿入、または削除された行の数を取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ Row  Update通じて送信された DataRow を取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ RowCount  バッチでの更新済みレコード処理された行数を取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ StatementType  実行されSQL ステートメント種類取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ Status  Command プロパティの UpdateStatus を取得します。(RowUpdatedEventArgs から継承されます。)
パブリック プロパティ TableMapping  Update通じて送信された DataTableMapping を取得します。(RowUpdatedEventArgs から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SqlRowUpdatedEventArgs クラス
System.Data.SqlClient 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からSqlRowUpdatedEventArgsを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSqlRowUpdatedEventArgsを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSqlRowUpdatedEventArgsを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SqlRowUpdatedEventArgs」の関連用語

SqlRowUpdatedEventArgsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SqlRowUpdatedEventArgsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS