DataSet.Merge(DataSet) create new tables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sscanf
    New Member
    • Apr 2009
    • 2

    DataSet.Merge(DataSet) create new tables?

    Hello,

    I have a empty oldDataSet. Then with the proper adapter i Fill a new DataSet newDataSet with two tables (Table1 and Table2) that dont exist in oldDataSet.

    Then i do oldDataSet.Merg e(newDataSet) and the tables from newDataSet dont appear in oldDataSet.

    I need it to "update" a dataset from a sql server, so i construct the sql server adapter that fills the newDataSet and then i need to upload the results to existing oldDataSet. But if oldDataSet dont have a table that newDataSet has the table dont appears in oldDataSet after Merge().

    Can anyone help me?

    Thank you
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    The Merge() method is used when DataSet's have similar schemas. In your case these schemas are not similar (whole tables are missing).

    I think you'd be interested in using the GetChanges() method. This method gets a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called.

    You can set the oldDataSet to the DataSet returned by the GetChanges method.

    Comment

    • madankarmukta
      Contributor
      • Apr 2008
      • 308

      #3
      Originally posted by sscanf
      Hello,

      I have a empty oldDataSet. Then with the proper adapter i Fill a new DataSet newDataSet with two tables (Table1 and Table2) that dont exist in oldDataSet.

      Then i do oldDataSet.Merg e(newDataSet) and the tables from newDataSet dont appear in oldDataSet.

      I need it to "update" a dataset from a sql server, so i construct the sql server adapter that fills the newDataSet and then i need to upload the results to existing oldDataSet. But if oldDataSet dont have a table that newDataSet has the table dont appears in oldDataSet after Merge().

      Can anyone help me?

      Thank you

      Hi,

      As per my understanding, you should perform oldDataSet.Acce ptChanges () once you have done with oldDataSet.Merg e(newDataSet).

      Try it once.

      Thanks!

      Comment

      • sscanf
        New Member
        • Apr 2009
        • 2

        #4
        OK resolved.

        But when i do oldDataSet.Upda te() it doesnt not take any changes :s

        Comment

        Working...