Updating only changed rows in database

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Hi,

When I update my database, I call the updates like this (in order to submit
hierarchial changes properly):

daAdapter.Update(tblMyTable.Select("", "", DataViewRowState.Added))
daAdapter.Update(tblMyTable.Select("", "",
DataViewRowState.ModifiedCurrent))
daAdapter.Update(tblMyTable.Select("", "", DataViewRowState.Deleted))

When working with the dataset, I have tons of rows in some tables that are
often accessed (I pull data from the tables and display the data on
controls), but no data in them is changed. The rows are still marked as
ModifiedCurrent, and it takes a few seconds for all the rows to update.
Really, I don't need these rows to be resubmitted at all. Will the
DataSet.HasChanges method work for me, or is there another way to tell the
update event not to update these "unchanged" rows?

Thanks in advance,

Nathan
 
Nathan,

AFAIK will only the rows with a changed rowstate be updated and you don't
need all those extentions.

You can test it yourself, you can as well make something as a kind of this
routine

if mydataset.haschanges then
da.update(mydataset.getchanges)
mydataset.acceptchanges '(in this way of use needed)
end if

And that of course with all errror handling.

To explain this
haschanges looks if there are changes
getchanges makes a copy dataset of all changed rows
acceptchanges set all rowstates too changes done

I hope this helps?

Cor
 
Aah, I think I realized what's causing my rows to be marked as modified--I
AM sending information back to the rows. My mistake!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top