473,395 Members | 1,677 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,395 software developers and data experts.

Concurrency Violation

I have a client using IE with a .net web application who
is getting a Concurrency Violation whenever she tries to
update certain records in her database.

The strange thing is that I can open up multiple instances
of IE an go to the same page and update the same record
from all 3 instances at the same time as she is getting
the error.

The update is being done using a dataadapter and dataset
with optimistic locking.

Any help would be greatly appreciated.

Billy Jacobs
Jul 21 '05 #1
3 9513
Are you saying that the same code works for you but doesn't work for
her? You might want to put a Profiler trace on the application
(assuming you are using SQL Server) so you can take a look at what's
going on at the server.

-- Mary
MCW Technologies
http://www.mcwtech.com

On Fri, 10 Oct 2003 08:09:13 -0700, "Billy Jacobs"
<bi********@csa.com> wrote:
I have a client using IE with a .net web application who
is getting a Concurrency Violation whenever she tries to
update certain records in her database.

The strange thing is that I can open up multiple instances
of IE an go to the same page and update the same record
from all 3 instances at the same time as she is getting
the error.

The update is being done using a dataadapter and dataset
with optimistic locking.

Any help would be greatly appreciated.

Billy Jacobs


Jul 21 '05 #2
Are you saying that the same code works for you but doesn't work for
her? You might want to put a Profiler trace on the application
(assuming you are using SQL Server) so you can take a look at what's
going on at the server.

-- Mary
MCW Technologies
http://www.mcwtech.com

On Fri, 10 Oct 2003 08:09:13 -0700, "Billy Jacobs"
<bi********@csa.com> wrote:
I have a client using IE with a .net web application who
is getting a Concurrency Violation whenever she tries to
update certain records in her database.

The strange thing is that I can open up multiple instances
of IE an go to the same page and update the same record
from all 3 instances at the same time as she is getting
the error.

The update is being done using a dataadapter and dataset
with optimistic locking.

Any help would be greatly appreciated.

Billy Jacobs


Jul 21 '05 #3
Hello Billy,

Thanks for your post.

Generally speaking, the Update method will raise a DBConcurrencyException
exception when the method encounters a row that fails to update. It seems
to me that your Update statement is based on optimistic concurrency, that
is, records are not locked for editing, and other users or processes can
modify records whenever. It will be the ase that an Update statement will
try to update a row that has been deleted or does not contain the original
values that are found in the DataSet, and thus causes the
DBConcurrencyException.

To workaround this issue, you can explicitly set the UpdateCommand for the
DataAdapter and not rely on automatic commend generation as described in
the KB aticle 308507:

HOW TO: Update a SQL Server Database by Using the SqlDataAdapter Object in
Visual C# .NET
http://support.microsoft.com/?KBID=308507

I'd also like to recommend you the MSDN article below:

Optimistic Concurrency
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconoptimisticconcurrency.asp

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4

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

Similar topics

2
by: Billy Jacobs | last post by:
I have a client who is getting a concurrency violation error whenever she tries to update a record. I can log in to the site as her simultaneously and update the record with no problem. I can...
3
by: Suzanne | last post by:
Hi All I'm having problems getting my data adapter to throw a concurrency exception with an INSERT command. I want to throw a concurrency exception if an attempt is made to enter a row into...
25
by: nick | last post by:
I'm having trouble updating from a datagrid. It's says "Concurrency violation: the UpdateCommand affected 0 records", though I can't see how it's related to "concurrency". I can insert and delete...
2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
4
by: Steven Nagy | last post by:
Hi Have a problem that consistantly occurs in my applications where using a DataAdapter (OLEDB) and a dataset. Using a simple process of adding a row to the dataset table and then calling the...
2
by: Vladimir Oľura | last post by:
I am building a pocket pc application that requires a datagrid. I am inserting a new row this way: private void mInsert_Click(object sender, System.EventArgs e) { try { DataRow dr =...
4
by: Jerry | last post by:
Hi, I have an app which retrieves data from a sql server table and displays it on a datagrid. If 2 sessions of this app are running and 2 users try to update the same record at about the same...
2
by: Agnes | last post by:
I got a simple form and using databinding manager to do the add new Now , my big trobule is . I can update the 'addnew' record, However, after I new the record, and then amend it , it got...
2
by: BobAchgill | last post by:
Do you know why this error might be happening? Maybe it is because I have two data adapters open on the same MDB file?? If this is the problem... how can I keep them from disturbing each other?...
5
by: Vayse | last post by:
In my save code, most of items save fine. But sometimes I get a concurrency violation message. "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." It happens on the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.