473,406 Members | 2,769 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,406 software developers and data experts.

Compare 2 DataSets

Al
I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just structure with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the first
one is used as DataSource for many controls and the second one is untouched.
If there were some changes in the first one, I'd like to know it and would
like to compare with the second one. I don't know how. Everything I need to
know is just were there any changes or not. If yes I will ask the user if he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody can
suggest a better way to catch changes?

Thank you
Al
Aug 3 '06 #1
6 1640
Al,

The dataset has a HasChanges method that might work for you.

Kerry Moorman
"Al" wrote:
I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just structure with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the first
one is used as DataSource for many controls and the second one is untouched.
If there were some changes in the first one, I'd like to know it and would
like to compare with the second one. I don't know how. Everything I need to
know is just were there any changes or not. If yes I will ask the user if he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody can
suggest a better way to catch changes?

Thank you
Al
Aug 3 '06 #2
Al
Unfortunately HasChanges method returns True even right after populating
DataSet from XML file. I do not know why.
I also tried to populate another DataSet with GetChanges method. No success
too - the resulting DataSet has rows in Tables. Do not know why either.

Al
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:29**********************************@microsof t.com...
Al,

The dataset has a HasChanges method that might work for you.

Kerry Moorman
"Al" wrote:
>I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just structure
with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the
first
one is used as DataSource for many controls and the second one is
untouched.
If there were some changes in the first one, I'd like to know it and
would
like to compare with the second one. I don't know how. Everything I need
to
know is just were there any changes or not. If yes I will ask the user if
he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody can
suggest a better way to catch changes?

Thank you
Al

Aug 3 '06 #3
Al,

Have you tried calling the dataset's AcceptChanges method immediately after
initially loading it? After that, HasChanges may correctly reflect changes
since loading.

Kerry Moorman
"Al" wrote:
Unfortunately HasChanges method returns True even right after populating
DataSet from XML file. I do not know why.
I also tried to populate another DataSet with GetChanges method. No success
too - the resulting DataSet has rows in Tables. Do not know why either.

Al
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:29**********************************@microsof t.com...
Al,

The dataset has a HasChanges method that might work for you.

Kerry Moorman
"Al" wrote:
I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just structure
with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the
first
one is used as DataSource for many controls and the second one is
untouched.
If there were some changes in the first one, I'd like to know it and
would
like to compare with the second one. I don't know how. Everything I need
to
know is just were there any changes or not. If yes I will ask the user if
he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody can
suggest a better way to catch changes?

Thank you
Al


Aug 3 '06 #4
Al
I called AcceptChanges method as you suggested and now HasChanges returns
False before any change as well as after changes.

Al

"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:71**********************************@microsof t.com...
Al,

Have you tried calling the dataset's AcceptChanges method immediately
after
initially loading it? After that, HasChanges may correctly reflect changes
since loading.

Kerry Moorman
"Al" wrote:
>Unfortunately HasChanges method returns True even right after populating
DataSet from XML file. I do not know why.
I also tried to populate another DataSet with GetChanges method. No
success
too - the resulting DataSet has rows in Tables. Do not know why either.

Al
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:29**********************************@microso ft.com...
Al,

The dataset has a HasChanges method that might work for you.

Kerry Moorman
"Al" wrote:

I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just
structure
with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the
first
one is used as DataSource for many controls and the second one is
untouched.
If there were some changes in the first one, I'd like to know it and
would
like to compare with the second one. I don't know how. Everything I
need
to
know is just were there any changes or not. If yes I will ask the user
if
he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody
can
suggest a better way to catch changes?

Thank you
Al



Aug 4 '06 #5
Al
I cannot be sure yet, but I think with your help I found what is wrong. I
used to call AcceptChanges method every time I'm making changes in any
DataTable. I was thinking that this method will save my changes in the
DataSet only and without calling this method I will lose the changes I make.
I commented all AcceptChanges calls and now HasChanges seems to work
properly.
So for now I do not need to to worry about losing any change I make and I
just need to ask the user if he wants to save data into XML only in case
when HasChanges returns True.

Thank you very much

Al

"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:71**********************************@microsof t.com...
Al,

Have you tried calling the dataset's AcceptChanges method immediately
after
initially loading it? After that, HasChanges may correctly reflect changes
since loading.

Kerry Moorman
"Al" wrote:
>Unfortunately HasChanges method returns True even right after populating
DataSet from XML file. I do not know why.
I also tried to populate another DataSet with GetChanges method. No
success
too - the resulting DataSet has rows in Tables. Do not know why either.

Al
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:29**********************************@microso ft.com...
Al,

The dataset has a HasChanges method that might work for you.

Kerry Moorman
"Al" wrote:

I'd like to know if there were any changes in the DataSet which was
populated by reading XML file. 6 DataTables with data or just
structure
with
no data inside of it.
I think about this scenario:
I create 2 datasets and populate both from the same XML file. Then the
first
one is used as DataSource for many controls and the second one is
untouched.
If there were some changes in the first one, I'd like to know it and
would
like to compare with the second one. I don't know how. Everything I
need
to
know is just were there any changes or not. If yes I will ask the user
if
he
wants to save them back into XML file.

So the question again: How do I compare 2 datasets? Or maybe somebody
can
suggest a better way to catch changes?

Thank you
Al



Aug 4 '06 #6

"Al" <al@newsgroups.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>I cannot be sure yet, but I think with your help I found what is wrong. I
used to call AcceptChanges method every time I'm making changes in any
DataTable. I was thinking that this method will save my changes in the
DataSet only and without calling this method I will lose the changes I
make.
I commented all AcceptChanges calls and now HasChanges seems to work
properly.
Yes, this is common misundestanding of what AcceptChanges really does. I
guess the name is misleading...

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Aug 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: codejockey | last post by:
I have a simple project that requires I take a set of data from an Excel spreadsheet, compare it to a table in SQL Server (where column names match), and if there are changes in the Excel sheet,...
0
by: codejockey | last post by:
Please forgive the repost, but I'm trying to avoid the hack I want to implement since I cant get this sample to work. Can anyone help? *********************** William: Thanks for the reply. I...
2
by: gibster | last post by:
Hi I'm looking for some help comparing 2 datasets, each dataset has 2 datatables; the first table's rows consist of text status (1 or 0) GUID
1
by: Mark | last post by:
by m.r.davies I have 2 tables on seperate Db's (and servers) I want to use a datareader on the first table to pick the booking ref, and then use that booking ref to query the 2nd DB when i have...
4
by: Justin Emlay | last post by:
I have two lists. These can be in either table form or array. That is, my data is in a dataset which I can move to an array if need be. ListA is a master list and it contains all items. ListB...
0
by: Frank | last post by:
Hello, Developing an app where the user fills out a sometimes quite lengthy form of chkboxes, txtboxes, radbtns, etc. User responses are saved to a mySql db, which the user can later edit. When...
0
by: austenr | last post by:
I need to compare data sets that have been updated with newer versions. Is there a way to compare the old data set to the new one and determine what tables differ? The environment is DB2. Thanks...
6
by: Al | last post by:
I'd like to know if there were any changes in the DataSet which was populated by reading XML file. 6 DataTables with data or just structure with no data inside of it. I think about this scenario:...
3
by: sonymathur | last post by:
I'm using two datasets DS1 & DS2 (both hold data with same schema) in VB.Net 1.1 DS1 is main datasets and DS2 is like subset to DS1.Now how should i remove datarows from DS1 that are like in DS2....
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
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?
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
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,...

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.