473,396 Members | 2,020 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 1441
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
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.