User A and User B modify the same record, UserB save first.
As User A save it , I will get the concurrency error.
I know I can use
Try
... dsTable.udpate()
catch err As DbCurrency
messagebox.show("UpdateFailed ")
end try
However, How can I let User A know "User B save the same record already ",
and ask USER A whether overwrite it or not , If User A press "Yes" , his
record should saved correctly.
Does anyone know how to do '
Thanks a lot.Sorry, I should place this post in vb.net
"Agnes" <agnes@.dynamictech.com.hk> glsD:etbwTeMTFHA.1044@.TK2MSFTNGP10.phx.gbl...[
color=darkred]
> User A and User B modify the same record, UserB save first.
> As User A save it , I will get the concurrency error.
> I know I can use
> Try
> ... dsTable.udpate()
> catch err As DbCurrency
> messagebox.show("UpdateFailed ")
> end try
> However, How can I let User A know "User B save the same record already ",
> and ask USER A whether overwrite it or not , If User A press "Yes" , his
> record should saved correctly.
> Does anyone know how to do '
> Thanks a lot.
>[/color]|||Firstly, this probably isn't the forum for this. You check out a VB.NET foru
m
from the looks of your post. Secondly, it appears you are using a
DataSet/DataTable and DataAdapter together to do your updates (something you
should mention when you post to the other forum).
> However, How can I let User A know "User B save the same record already ",
and
> ask USER A whether overwrite it or not , If User A press "Yes" , his recor
d
> should saved correctly.
That all depends on what type of information you are trying to tell UserA. B
y
far the simplest solution is to tell UserA that *someone*, not UserB
specifically, wrote to that row. It technically should not matter who it was
the
wrote to that row before UserA only that someone did. However, if for some
reason that is important, then you need to add some logging capabilities to
the
table or to the database in general. That would either take the form of colu
mns
that are populated with the user that last modified the row or a logging tab
le
that is appended whenever a row in this table is modified. With logging
capabilities in place and this concurrency scenario arises, you'll have to q
uery
for the row again (or the log history) and display the username of the last
user
that modified the row.
HTH
Thomas
"Agnes" <agnes@.dynamictech.com.hk> wrote in message
news:etbwTeMTFHA.1044@.TK2MSFTNGP10.phx.gbl...
> User A and User B modify the same record, UserB save first.
> As User A save it , I will get the concurrency error.
> I know I can use
> Try
> ... dsTable.udpate()
> catch err As DbCurrency
> messagebox.show("UpdateFailed ")
> end try
> However, How can I let User A know "User B save the same record already ",
and
> ask USER A whether overwrite it or not , If User A press "Yes" , his recor
d
> should saved correctly.
> Does anyone know how to do '
> Thanks a lot.
>|||How do you know that two users have modified the same row? Do you have data
stored in the row or a log that tells you this? If you are just using a
rowversion(timestamp) column then you really cannot tell them who overwrote
it.
You might consider adding a column or two to your table to tell who last
updated the row, then when the timestamp mismatches, you can get the current
row by primary key (assuming the key is not updatable) and then go fetch the
modified row. Show the user what the other user changed, and who modified
it, and they will be awfully happy.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Agnes" <agnes@.dynamictech.com.hk> wrote in message
news:etbwTeMTFHA.1044@.TK2MSFTNGP10.phx.gbl...
> User A and User B modify the same record, UserB save first.
> As User A save it , I will get the concurrency error.
> I know I can use
> Try
> ... dsTable.udpate()
> catch err As DbCurrency
> messagebox.show("UpdateFailed ")
> end try
> However, How can I let User A know "User B save the same record already ",
> and ask USER A whether overwrite it or not , If User A press "Yes" , his
> record should saved correctly.
> Does anyone know how to do '
> Thanks a lot.
>
No comments:
Post a Comment