Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2009, 09:27 AM
Authorized User
 
Join Date: Feb 2008
Location: Keighley, , United Kingdom.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update problems

Hi

I have a strange probelem.

My form only inserts into the database.

To get all the table adapters etc on my form, I drag on the required database table from Data Sources then remove the binding navigator strip.

In the auto generated form-load procedure I add a
  • myTableBindingSource.AddNew()
  • and initialise the new record.
  • end the form load procedure.
Then allow the user to input data in the form
  • check all data is valid and all keyed in
  • save using myTableAdapter.Update
This works on all except the first attempt at insert which inserts a blank row and form fails with "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records2.
When I re-run the project - subsequent rows are inserted OK. The inital blank row is not updated and subsequent re-starts of the project to add more data does not overwirte any rows.

My initial table is empty.

Is there something I need to do to insert a first row in a datatable rather than AddNew?
__________________
Pat




Similar Threads
Thread Thread Starter Forum Replies Last Post
save and update data problems using flex grid naveed77 Beginning VB 6 0 December 6th, 2007 03:57 AM
Problems in ASP.NET 2 when I update my ODBC databa Armando Barbarin Rionda ASP.NET 1.0 and 1.1 Professional 0 June 30th, 2005 05:07 PM
Insert and update problems with OLEDB driver Cos Classic ASP Databases 2 September 24th, 2003 01:52 AM
update record problems whyulil Dreamweaver (all versions) 2 July 24th, 2003 04:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.