DataSet.acceptchanges RRS feed


  • Here an example from MSDN


    The following example adds a DataRow to a DataTable in a DataSet. The AcceptChanges method is then called on the DataSet, which cascades to all DataTable objects that it contains.


    Code Snippet

    Private Sub AcceptChanges()
       Dim myDataSet As DataSet
       myDataSet = new DataSet()

       ' Not shown: methods to fill the DataSet with data.
       Dim t As DataTable

       t = myDataSet.Tables("Suppliers")

       ' Add a DataRow to a table.
       Dim myRow As DataRow
       myRow = t.NewRow()
       myRow("CompanyID") = "NWTRADECO"
       myRow("CompanyName") = "NortWest Trade Company"

       ' Add the row.
       t.Rows.Add( myRow )

       ' Calling AcceptChanges on the DataSet causes AcceptChanges to be
       ' called on all subordinate objects.
    End Sub


    I hope this helps.



    Wilmar Acosta


    • Marked as answer by veenyad Tuesday, September 20, 2011 12:28 PM
    Tuesday, July 10, 2007 5:23 PM