|
-
Feb 16th, 2011, 06:47 AM
#1
Thread Starter
New Member
concurrency violation: The updatecommand affected 0 of the expected 1
im using a sqldataadapter, dataset and bindingsource to connect to a table. i retrieve all records from the database and i change the data on a field then update changes to database. when i try to change back to original value i get a Concurrency violation error (concurrency violation: The updatecommand affected 0 of the expected 1). this is the code:
Code:
Try
Me.Validate()
Me.sqlBindingSource.EndEdit()
Dim slqCmdBuilder As New SqlCommandBuilder(sqlAdapter)
Me.sqlAdapter.Update(Me.sqlDs.Tables("Items"))
slqCmdBuilder.Dispose()
slqCmdBuilder = Nothing
Me.sqlBindingSource.ResetBindings(True)
Catch ex As Exception
MessageBox.Show(ex.Message, "Ειδοποίηση", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
can anyone help me plz?
-
Feb 16th, 2011, 08:27 AM
#2
Re: concurrency violation: The updatecommand affected 0 of the expected 1
Are you changing the primary key?
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Feb 16th, 2011, 12:03 PM
#3
Thread Starter
New Member
Re: concurrency violation: The updatecommand affected 0 of the expected 1
i not changing the primary key nut i think i fihured it out. theres a trigger on my table that automatically updates the last date & time the record is changed. when i create my sqldata adapter i do a "select * from table" which in turn retrieves this record. i think that if i select all fields except this datetime field i soulded have a problem. whats your oppion?
-
Feb 16th, 2011, 12:13 PM
#4
Thread Starter
New Member
[SOLVED] concurrency violation: The updatecommand affected 0 of the expected 1
i was right. creating a script without the last update datetime of the record fixed the problem. thnx anyway
-
Feb 16th, 2011, 01:26 PM
#5
Re: concurrency violation: The updatecommand affected 0 of the expected 1
That's a very annoying problem, so it is good that you found such a rational solution.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|