473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1440
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
0
by: Nathan | last post by:
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))...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
2
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
12
by: MGM | last post by:
Hey everyone, I'm having some issues here. I have a large Access .mdb (over 400,000 rows). What I need to do is, there are 12 columns that need to be reordered (quite literally as simple as if...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.