473,611 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataAdapter Update method giving Concurrency Error

Okay,

The problem is that I have an Access Database that has the following
fields:

EmpID - Autonumber (PrimaryKey)
AccountID - Text
IssueReported - Memo
DateOpened - Date/Time
TimeOpened - Date/Time
DateClosed - Date/Time
TimeClosed - Date/Time

For simplicity of explaining my problem I have a form with 2 buttons,
1 for delete, 1 for an update to the database after the delete. Then
there's a datagrid to view the results.

When I select to delete 1 row from the dataset the row deletes as
expected and the datagrid will confirm this by showing the row
removed. Ofcourse, this is only in memory and not on the actual
database.

So when I attempt to update the table using the dataAdapters update
method immediately after the delete command is performed, I receive
the error:
"Concurrenc y violation: the DeleteCommand affected 0 records"
and the database isn't updated. :(

If I move the dataAdapter Update method to the click event of the
update button to execute the update method after the rows have been
deleted from the dataset, I don't any longer receive the error but
database still doesn't get updated and all the rows remain
unaffected.

I have searched many sources and newsgroups but I am stuck on this
one. I have seen that others have encountered the error as well but
none of the answers explain my problem.

Can anyone help me????

Here is my code, the Declarations for the Dataset, ConnectionStrin g,
and DataAdapter objects are handled in the form designer so you won't
see them in the code:

Public Class Form1
Inherits System.Windows. Forms.Form

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

OleDbDataAdapte r1.Fill(DsProbl emReport)
DataGrid1.DataS ource = DsProblemReport .Tables(0)

End Sub

Private Sub btnDelete_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

DsProblemReport .Tables(0).Rows (0).Delete()
DsProblemReport .ProblemReport. AcceptChanges()

End Sub

Private Sub btnUpdate_Click (ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnUpdate.Click

DsProblemReport .Clear()
OleDbDataAdapte r1.Update(DsPro blemReport.Tabl es(0))
OleDbDataAdapte r1.Fill(DataSet 31)

End Sub
End Class

HELP!!!!!!
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 21 '05 #1
1 2308
Mivey,

You are not the only one who have this problem, however you use the
autonumber.

Are you able to use a GUID in that uniqueidentifie r, that will make your
life probably a lot happier.

Just my thought,

Cor
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
368
by: Job Lot | last post by:
am binding my DataGrid using a StoredProc which uses an OuterJoin query as follows: CREATE PROCEDURE spGetClientExpenses @Client_ID int AS SELECT Expense_Details.Exp_Detail_ID,Expense_Details.Exp_Cat_ID, CASE WHEN Client_Expenses.Client_ID IS NULL THEN @Client_ID ELSE Client_Expenses.Client_ID END AS Client_ID,Expense_Details.Description, CASE WHEN Client_Expenses.CashExpenditure IS NULL THEN 0 ELSE
0
1039
by: ardin | last post by:
anyone please help, i am developing and application that uses the update method of dataadapter (select, update, delete command was set by issuing the OleDbCommandBuilder)in updating the database. using this method readily answers the concurrency issue. however, i always read from various posts that is is best to use stored procs with dataadapter. if i use this approach, how will the concurrency issue be taken care of? please provide...
2
2870
by: Joe Fetters via .NET 247 | last post by:
Have googled and read the VS.NET documentation can't seem to getthe answer to the following. Environment: Framework 1.1 VB.NET WinForm Access database Using all automagic tools (DataAdapter Wizard with generatedDataset and generated Select, Update, Insert and Deletecommands, controls bound to DataSet using the AdvancedDatabinding properties) Issue: Do I have to set parameters before I issue theDataSet.Update(Dataset, )? Again, my...
2
3703
by: John Smith | last post by:
i dont understand how to use `em all those @id ... what they have to do with a datagrid bound to a dataset filled by an adapter TIA
13
2077
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an OleDbCommand with an SQL String and the connection it has a DataAdapter with the command then it fills the DataSet's DataTable with the streamed data.
3
1792
by: RJN | last post by:
Hi I'm using the Dataadapter and Dataset to do an insert/update/delete into tables. The dataset has multiple tables in it. I want to write my own Update/Insert commands for the Dataadapter for each of the tables and not use the ones created by SqlCommandBuilder. The Update/Delete commands created by Command builder do not create where clause based on the primary key but the where cluase created will be based on all the columns. This...
8
2688
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
6
13988
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection = conn da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1" da.Update(tblx) '--tblx/tbl1 not getting updated here.
2
4168
by: Frogpolish | last post by:
well after searching ans coming up with nothing i figured id post something in here to see if i could get some help. i have an access db that keeps track of flights that ive flown. its a logbook basically. now im writing a program to add to that database and for some reason it keeps giving me "Syntax error in INSERT INTO statement" when it comes to the dataadapter.update method. here is the code, i will also include a link to the code with all...
0
8097
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8596
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8561
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8240
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7038
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4042
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.