Results 1 to 4 of 4

Thread: old value in dataset

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    222

    old value in dataset

    How does dataset stores old value?

    Suppose we have changed several records and when do we save the recrds it sends the update command to database with new changed and old values.

  2. #2
    Member
    Join Date
    Mar 2004
    Posts
    39
    If I remember correctly it works like this:

    When you make changes to a row in a datatable the row's rowstate property i changed to "modified" and if you delete the row it actually is not removed but just marked as "deleted" in the rowstate property. When the dataset is updated against the database it updates the database with the modifications on all rows that are not marked as "unchanged" in the rowstate property.

    This should mean that it does not store the old data, it changes the data and marks the row as "modified" and when updating to db does the update with a big, kinda complex UPDATE query.

    Anyone feel free to correct me if I'm remembering incorrectly.

    /Nisse

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    222

    old value in dataset

    Thanks for the answer.
    But I found that the updatequery is something like

    update table set fld1=?,.......
    where fld1=?,.......

    to execute this query we should pass the new changed value before "where" field1=newvalye,... and should pass the old value
    after "where" where field1=oldvalue and ...........

  4. #4
    Member
    Join Date
    Mar 2004
    Posts
    39
    You are correct, I had a memory flaw I guess. =)

    If you use .NET to build a update command it will use 2 sets of parameters, one set with "new values" and one set with "original values". Those parameters differs in the SourceVersion property, current or original.

    I almost always work with typed datasets so all this is done in the background.

    /Nisse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width