By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,693 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,693 IT Pros & Developers. It's quick & easy.

multi-user data entry

P: n/a
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file.
However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his
own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
..
..
..

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
..
..
..

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well
as objEdit. Why is that happening?

Thanks.

Pat
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
An ADO.NET group will be able to handle this better, but there are lots of
ways to do this such as using something as simple as GetChanges.. I think a
dataset also implements IComparable in which case you can get the changes
out.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file.
However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his
own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well
as objEdit. Why is that happening?

Thanks.

Pat

Nov 20 '05 #2

P: n/a
Hmm. Correct me if I'm wrong, but I think your
suggestion finds the changed rows that the user makes
himself. The underlying XML file may have been changed
several times during the user's editing activities. I
want to find if the XML file has been changed (by other
users) during the user's editing activities.

Thanks,

Pat
-----Original Message-----
An ADO.NET group will be able to handle this better, but there are lots ofways to do this such as using something as simple as GetChanges.. I think adataset also implements IComparable in which case you can get the changesout.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file. However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well as objEdit. Why is that happening?

Thanks.

Pat

.

Nov 20 '05 #3

P: n/a
This is a common thing I see, I use SQL though to do Pessemistic locking
(something you should be VERY careful with). What I'm saying is, you could
reload the XML file, and then validate changes agasint both of them, and do
whatever BL you need to do..

Now if you want to get "creative" you could use a FileSystemWatcher to
watch to see if the XML file was updated at anytime, and notify the user
instantly if they want to import these changes. Depending on how many users
you have / how many updates there are, this could get ugly. (File keeps
changing, user keeps getting notified) You also would have to write your
own handler in updating the UI when a file changes and getting the changes
(seeing if it affects the current record or not). but you have to remember
Datasets are disconnected so it can't necessarily watch to see when someone
else updates automaticalliy.

If you have some extra money check out Microsoft ADO.NET Core Reference
guid. ISBN 0-7356-1423-7 which I found pretty useful when learning about
Pessemistic locking.
USA pricing is 59.99. Canada 86.99,

Has a CD too...


"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:04****************************@phx.gbl...
Hmm. Correct me if I'm wrong, but I think your
suggestion finds the changed rows that the user makes
himself. The underlying XML file may have been changed
several times during the user's editing activities. I
want to find if the XML file has been changed (by other
users) during the user's editing activities.

Thanks,

Pat
-----Original Message-----
An ADO.NET group will be able to handle this better, but

there are lots of
ways to do this such as using something as simple as

GetChanges.. I think a
dataset also implements IComparable in which case you

can get the changes
out.

-CJ
"Patrick McGuire" <pm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...
I am instantiating several custom objects from a subset
of data contained in an XML file. I then might edit
these objects and save the changes back to the XML file. However, I want to compare the original state of the
objects with the current object data stored in the XML
file to alert the user to any changes that were made by
other users during the time that the user was making his own edits.

So I'm doing this:

objEdit= createobject(xmldata)
objOriginal= createobject(xmldata)

DATA EDITING (of objEdit)
.
.
.

objCurrent = createobject(xmldata)

if not objCurrent.Equals(objOriginal) then

msgbox "Another user made changes..."
.
.
.

else

savedata(objEdit)

end if

Two questions:
1) Is this the best approach?
2) For some reason the edits affect objOriginal as well as objEdit. Why is that happening?

Thanks.

Pat

.

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.