PC Review


Reply
Thread Tools Rate Thread

Concurrency violation override for delete.

 
 
Chris Hock
Guest
Posts: n/a
 
      16th Jul 2003
I'm using VS.Net 2003 (C#). I have a data adapter which
performs simple CRUD operations on a table. When creating
the data adapter I opted NOT to use the Optimistic
concurrency.

The sql update statement works as expected. The row
updates regardless of whether the data was modified after
the read and prior to the update. However, the delete
appears to always require a row be deleted. My
application reads the row, then I delete the row from the
SQL Server table manually, and then I try to delete the
row with the application.

If I turn off Optimistic concurrency I would expect the
delete statement to not care whether the row existed or
not. However, it appears that it requires at least one
row to be deleted regardless of whether Optimistic
concurrency is used or not.

Does anyone know a way around this issue? I want the
delete operation to succeed regardless of how many rows
are deleted.

Thanks,
Chris
 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      16th Jul 2003
How was the DeleteCommand constructed? You can build it any way you wish--as
long as it returns rows affected = 1.


--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Chris Hock" <(E-Mail Removed)> wrote in message
news:0cb501c34bb7$796f46e0$(E-Mail Removed)...
> I'm using VS.Net 2003 (C#). I have a data adapter which
> performs simple CRUD operations on a table. When creating
> the data adapter I opted NOT to use the Optimistic
> concurrency.
>
> The sql update statement works as expected. The row
> updates regardless of whether the data was modified after
> the read and prior to the update. However, the delete
> appears to always require a row be deleted. My
> application reads the row, then I delete the row from the
> SQL Server table manually, and then I try to delete the
> row with the application.
>
> If I turn off Optimistic concurrency I would expect the
> delete statement to not care whether the row existed or
> not. However, it appears that it requires at least one
> row to be deleted regardless of whether Optimistic
> concurrency is used or not.
>
> Does anyone know a way around this issue? I want the
> delete operation to succeed regardless of how many rows
> are deleted.
>
> Thanks,
> Chris



 
Reply With Quote
 
David Sceppa
Guest
Posts: n/a
 
      17th Jul 2003
Chris,

Concurrency checks are built into the query the DataAdapter
executes to submit the pending change. There is no property for
the DataAdapter to check to achieve this behavior. Your best bet
would be to use just the key column(s) in WHERE clause for the
DeleteCommand's query, and then add code to the RowUpdated event
to check for delete attempts that affected no records and
interpret that result as success.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2003 Microsoft Corporation. All rights reserved.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concurrency Violation Dustin Davis Microsoft ADO .NET 13 11th Jan 2007 04:39 PM
Concurrency violation on Row Delete in Data Grid BobAchgill Microsoft VB .NET 2 12th May 2005 09:20 PM
Concurrency Violation: the Delete Command Affected 0 records Bob Vlad via DotNetMonster.com Microsoft VB .NET 1 6th Feb 2005 08:02 AM
Re: Concurrency Violation on Delete command; first record only Steven Nagy Microsoft C# .NET 3 29th Dec 2004 06:40 AM
Concurrency Violation Nathan Microsoft ADO .NET 2 25th Jan 2004 11:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:26 AM.