DataTable.AcceptChanges メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataTable.AcceptChanges メソッドの意味・解説 

DataTable.AcceptChanges メソッド

前回 AcceptChanges呼び出した以降にこのテーブルに対して行われたすべての変更コミットます。

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

Public Sub AcceptChanges
Dim instance As DataTable

instance.AcceptChanges
public void AcceptChanges ()
public:
void AcceptChanges ()
public void AcceptChanges ()
public function AcceptChanges ()
解説解説
使用例使用例

テーブルエラーがあるかどうか確認する例を次に示しますテーブルエラーを (未定関数エラー渡して) 調整できる場合AcceptChanges呼び出されます。それ以外場合は RejectChanges が呼び出されます。

Private Sub AcceptOrReject(table As
 DataTable)
    ' If there are errors, try to reconcile.
    If( Not table.HasErrors) 
       If(Reconcile(table))
          ' Fixed all errors.
          table.AcceptChanges
       Else
         ' Couldn'table fix all errors.
          table.RejectChanges
       End If
    Else
       ' If no errors, AcceptChanges.
       table.AcceptChanges()
    End If
 End Sub
 
Private Function Reconcile(thisTable As
 DataTable) As Boolean
    Dim row As DataRow
    For Each row in thisTable.Rows
       'Insert code to try to reconcile error.

       ' If there are still errors return immediately
       ' since the caller rejects all changes upon error.
       If row.HasErrors Then
           Reconcile = False
           Exit Function
       End If
    Next row
    Reconcile = True
 End Function
private void AcceptOrReject(DataTable table)
{
    // If there are errors, try to reconcile.
    if(!table.HasErrors)
    { 
        if(Reconcile(table))
        {
            // Fixed all errors.
            table.AcceptChanges();
        }
        else
        {
            // Couldn'table fix all errors.
            table.RejectChanges();
        }
    }
    else
        // If no errors, AcceptChanges.
        table.AcceptChanges();
}
 
private bool Reconcile(DataTable thisTable)
{
    foreach(DataRow row in thisTable.Rows)
    {
        //Insert code to try to reconcile error.

        // If there are still errors return immediately
        // since the caller rejects all changes upon error.
        if(row.HasErrors)
            return false;
    }
    return true;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

「DataTable.AcceptChanges メソッド」の関連用語

DataTable.AcceptChanges メソッドのお隣キーワード
検索ランキング

   

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



DataTable.AcceptChanges メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS