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