Error message when you update a database by using a stored procedure: "System.Data.DBConcurrencyException" (310375)
The information in this article applies to:
- Microsoft ADO.NET (included with the .NET Framework)
- Microsoft Visual Basic .NET (2002)
This article was previously published under Q310375 This article refers to the following
Microsoft .NET Framework Class Library namespaces:
- System.Data.OleDb
- System.Data.SqlClient
SYMPTOMS When you use a DataAdapter object to write changes back to a database by means of a stored
procedure, you may receive the following error message:
An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in
system.data.dll
Additional information: Concurrency violation: the
UpdateCommand affected 0 records. If the data is not updated
correctly, you should receive a DataConcurrencyException exception instead of
the above-mentioned error message. CAUSE This problem can occur if the stored procedure runs the SET
NOCOUNT ON statement. RESOLUTION To receive an exception when the data is not updated
properly, you must explicitly add the SET NOCOUNT OFF statement to the stored
procedure. STATUSThis
behavior is by design.REFERENCES For more information about ADO.NET objects and syntax,
refer to the following Microsoft .NET Framework Software Development Kit (SDK)
documentation: For
additional information about how to update a SQL Server database, click the
article number below to view the article in the Microsoft Knowledge Base: 308055 HOW TO: Update a SQL Server Database by Using the SqlDataAdapter Object in Visual Basic .NET
Modification Type: | Minor | Last Reviewed: | 3/9/2006 |
---|
Keywords: | kbprb kbSqlClient kbSystemData KB310375 |
---|
|