PC Review


Reply
Thread Tools Rate Thread

Concurrency Violation Help

 
 
=?Utf-8?B?QnJ5YW4gWk0=?=
Guest
Posts: n/a
 
      15th Feb 2005
I have a dataset that contains 2 datatables. When I change a record and try
the update command it gives me this error...
Concurrency violation: the UpdateCommand affected 0 records. at
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping
tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)

Here is the code:
SqlConnection con = new SqlConnection(strCon) ;
try
{
con.Open() ;
daAllSigns = new SqlDataAdapter(sqlAllSigns,con) ;

SqlCommandBuilder cb = new SqlCommandBuilder(daAllSigns) ;

daAllSigns.Fill(dsGrids,"AllSigns") ;


daQueSigns = new SqlDataAdapter(QueSigns,con) ;


daQueSigns.Fill(dsGrids,"QueSigns") ;


// Change record
dsGrids.Tables["AllSigns"].Rows[3]["Sign_Brand"] = "TEST BRAND" ;
dsGrids.Tables["AllSigns"].Rows[3]["Sign_SignDesc"] = "TEST DESC" ;

daAllSigns.Update(dsGrids.Tables["AllSigns"]) ;

catch(Exception exc)
{
Debug.WriteLine(exc.Message + " " + exc.StackTrace) ;
}

Does anyone know why this error could be coming up, the code seems pretty
straight forward to me....

 
Reply With Quote
 
 
 
 
David Sceppa
Guest
Posts: n/a
 
      1st Mar 2005
Bryan,

The code definitely look simple enough. I might be missing something,
but I don't see how the multiple tables in the DataSet could lead to this
problem.

The exception occurs when the server indicates that no rows were
affected by the query the DataAdapter executed. The DataAdapter interprets
this result as an update failure due to a concurrency issue and throws the
concurrency exception.

You'd stand a better chance of getting a helpful response on the
newsgroup if you're able to isolate and reproduce the problem, minimizing
the number of columns and rows involved, and including the initial query
you're using, as well as CREATE TABLE and INSERT INTO queries.

I hope this information proves helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2005 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 rj Microsoft VB .NET 0 22nd May 2006 08:03 AM
Concurrency violation (new try) Vladimir Oľura Microsoft C# .NET 2 29th Oct 2005 01:11 PM
Concurrency violation Vik Microsoft ASP .NET 0 7th Dec 2004 08:53 PM
Re: CONCURRENCY VIOLATION One Handed Man Microsoft ADO .NET 1 18th Aug 2003 07:17 AM
Concurrency Violation Hill Cheung Microsoft ADO .NET 1 4th Jul 2003 09:04 AM


Features
 

Advertising
 

Newsgroups
 


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