469,608 Members | 2,152 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,608 developers. It's quick & easy.

Updating only changed rows in database

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
Nov 21 '05 #1
3 1304
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
Nov 21 '05 #2
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
Nov 21 '05 #3
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!
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Ok**************@TK2MSFTNGP10.phx.gbl...
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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Jason | last post: by
2 posts views Thread by Alexey.Murin | last post: by
4 posts views Thread by Geoff | last post: by
3 posts views Thread by RSH | last post: by
2 posts views Thread by susan.f.barrett | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.