Updating modified rows in a dataset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • discovery
    New Member
    • May 2009
    • 2

    Updating modified rows in a dataset

    Hi All,

    I have a dataset which is bind to a datagridview. When changes are made and that dataset is modified, i want to edit the dataset and update two datarow with WHO did the change and WHEN did the change occur.

    Plz help. Thanks
  • discovery
    New Member
    • May 2009
    • 2

    #2
    Solution found !!
    What i did is create a new dataset and stored only modified rows in it. Then edit the new dataset modify the two datarows.
    Code:
    myds = ds.GetChanges(DataRowState.Modified)
                For Each dr In myds.Tables("mytablename").Rows
                    dr.BeginEdit()
                    dr("UpdatedBy") =loggedUsername
                    dr("UpdatedWhen") = tday.now()
                    dr.EndEdit()
                Next
    *****
    Hope it will someone else.
    Last edited by PRR; May 14 '09, 05:30 AM. Reason: Please post code in [code] [/code] tags.

    Comment

    Working...