473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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:
"Concurrency 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, ConnectionString,
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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

OleDbDataAdapter1.Fill(DsProblemReport)
DataGrid1.DataSource = DsProblemReport.Tables(0)

End Sub

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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.EventArgs) Handles btnUpdate.Click

DsProblemReport.Clear()
OleDbDataAdapter1.Update(DsProblemReport.Tables(0) )
OleDbDataAdapter1.Fill(DataSet31)

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 2293
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 uniqueidentifier, 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
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...
0
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. ...
2
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...
2
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
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...
3
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...
8
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. ...
6
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 =...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.