How to force DataAdapter NOT to update added rows?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dmitry Karneyev

    How to force DataAdapter NOT to update added rows?

    Hi!
    I've got a DataSet with tables corresponding to the database ones.
    And I've got a table for my calculations and databinding in app.
    To fill "my" table I use myTable.Rows.Ad d(...) and then edit necessary
    columns.
    When app closes I check dataset.HasChan ges() and if it is I make an update.
    But HasChanges always returns true because I've got added rows to "myTable".
    How to avoid such situation? Or how to change status of "myTable" rows to
    original?

    Thanks!


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: How to force DataAdapter NOT to update added rows?

    Dmitry,

    If possible, you will want to add all of the rows you need first and
    then call AcceptChanges. This will have the effect of changing the state of
    the rows to unchanged, and then you can perform your edits. The only change
    in the tables will then be the edits, and HasChanges will give you the
    result that you want.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Dmitry Karneyev" <karneyev@msn.c om> wrote in message
    news:%23fEGqxSq DHA.2804@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    > Hi!
    > I've got a DataSet with tables corresponding to the database ones.
    > And I've got a table for my calculations and databinding in app.
    > To fill "my" table I use myTable.Rows.Ad d(...) and then edit necessary
    > columns.
    > When app closes I check dataset.HasChan ges() and if it is I make an[/color]
    update.[color=blue]
    > But HasChanges always returns true because I've got added rows to[/color]
    "myTable".[color=blue]
    > How to avoid such situation? Or how to change status of "myTable" rows to
    > original?
    >
    > Thanks!
    >
    >[/color]


    Comment

    Working...