Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 5th, 2008, 10:33 PM
Registered User
Join Date: Jan 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default concurrency violation updating child table

Hey everyone,

I have 3 tables in an Access database - tblMain, tblDelivery, and tblOtherCosts. tblMain is the parent table with a primary key (ID) and tblDelivery and tblOtherCosts are detail tables with foreign keys (ID) in a one to many relationship with tblMain. Update and delete events are set to cascade (via Dataset Designer in VB 2008).

I display data from all three tables on a form: I have a DataGridView bound to tblMain. tblDelivery and tblOtherCosts have their respective textboxes (bound to the appropriate fields) on the form. tblMain also has a DataNavigator on the form.

I fill the dataset with:

Me.TblOtherCostsTableAdapter.Fill(Me.SpDataSet.tbl OtherCosts)
          Me.TblDeliveryTableAdapter.Fill(Me.SpDataSet.tblDe livery)

To save changes to the database, I use the following:

Private Sub TblMainBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TblMainBindingNavigatorSaveItem.Click

End Sub

If I edit a value in the databound text box for tblDelivery or tblOtherCosts and try to save it (update) I get "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records". Does anyone know why this is, and how I should modify my code to fix it?
Reply With Quote
  #2 (permalink)  
Old January 27th, 2008, 02:29 AM
Registered User
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

I don't know if this helps but it did give me better understanding of updating related tables:

It is a 13 minutes video Presented by Beth Massi (Microsoft) on the subject.


- Tsadok

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Concurrency Violation Exception Olorin ADO.NET 10 October 4th, 2007 12:21 PM
Concurrency Violation Problem - Please HELP! Aaron Edwards ASP.NET 2.0 Basics 0 March 25th, 2007 08:17 PM
Concurrency Violation Problem - Please HELP! Aaron Edwards ADO.NET 1 March 25th, 2007 08:15 PM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM
Concurrency Violation performing Database updates LaFeverMF VB Databases Basics 1 February 15th, 2004 01:51 PM

All times are GMT -4. The time now is 04:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.