RE: Resolving Conflicts
- From: Ammar S. Mitoori <msnews08@xxxxxxxxxxxxx>
- Date: Tue, 25 Aug 2009 10:46:01 -0700
hi, thanks for the replay
so suppose i want the last update to win without bothering the user i think
as start it will simplify my application how can that be done ? does it also
require coding ?
how the code you posted will change ?
but still i need to implement code for deleted records ?
""Hongye Sun [MSFT]"" wrote:
Hi Ammar,.
Thanks for your reply.
When conflict happens, it is up to you to add code to handle the errors
based upon your own business requirements. ADO.NET provides a
DBConcurrencyException object that returns the row that violates the
concurrency rules. For more information, see How to: Handle Concurrency
Errors (http://msdn.microsoft.com/en-us/library/y8fyz6xy.aspx).
Here is an example code to handle concurrency error:
Try
CustomersTableAdapter.Update(NorthwindDataSet)
Catch ex As DBConcurrencyException
Dim customErrorMessage As String
customErrorMessage = "Concurrency violation" & vbCrLf
customErrorMessage += CType(ex.Row.Item(0), String)
MessageBox.Show(customErrorMessage)
' Add business logic code to resolve the concurrency violation...
End Try
For your second question, UPDATE operation requires the record you are
updating is existing in the database. So in the senario you provided, the
operation will raise a DBConcurrencyException as mentioned above.
For ADD and DELETE operations:
Adding new records (the INSERT command) only requires the current values
since no original record exists and removing records (the DELETE command)
only requires the original values in order to locate the record to delete,
which is similar to UPDATE.
Please let me know if you need anything else unclear.
Sincerely,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- RE: Resolving Conflicts
- From: "Hongye Sun [MSFT]"
- RE: Resolving Conflicts
- References:
- Resolving Conflicts
- From: Ammar S. Mitoori
- RE: Resolving Conflicts
- From: "Hongye Sun [MSFT]"
- RE: Resolving Conflicts
- From: Ammar S. Mitoori
- RE: Resolving Conflicts
- From: "Hongye Sun [MSFT]"
- RE: Resolving Conflicts
- From: Ammar S. Mitoori
- RE: Resolving Conflicts
- From: "Hongye Sun [MSFT]"
- Resolving Conflicts
- Prev by Date: RE: What does this message mean?
- Next by Date: RE: Getting a Handle of a file stored on the server using FileStre
- Previous by thread: RE: Resolving Conflicts
- Next by thread: RE: Resolving Conflicts
- Index(es):
Relevant Pages
|