Concurrency Issues after a Delete has occurred in Access

D

Daren Hawes

Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a
Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
M

Miha Markic [MVP C#]

Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
D

Daren Hawes

Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????


_____

From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and
not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Hi I get this error below.
-------------------


An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a
Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
M

Miha Markic [MVP C#]

How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????




------------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
D

Daren Hawes

Standard. When I dragged the Table from the Server Explorer.

See Below

'

'OleDbConnection

'

Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _

"ocking Mode=1;Jet OLEDB:Database Password=;Data
Source=""D:\Clients\ABC\Air Train" & _

"
(Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb
"";Passw" & _

"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Micr" & _

"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;Extended Pro" & _

"perties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet
OLEDB:Create " & _

"System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Com" & _

"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt
Database=False" & _

""

'

'

'OleDbDeleteCommand1

'

Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Reminders WHERE
(EventID = ?) AND (ReminderDate = ? OR ? IS NULL AND " & _

"ReminderDate IS NULL) AND (ReminderTime = ? OR ? IS NULL AND
ReminderTime IS NUL" & _

"L) AND (Route = ? OR ? IS NULL AND Route IS NULL)"

Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_EventID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "EventID", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderDate",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderDate1",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderTime",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderTime1",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Route",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Route1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

'


_____

From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 8:15 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????


_____

From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and
not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Hi I get this error below.
-------------------


An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a
Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
P

Patrice

These kind of false concurrency detection is AFAIK most often caused by a delete criteria that returns no rows. The assumption is then that someone else changed the row.
Try perhaps to do first a select to see if a row is returned. If not see the SQL statement to find out whay. Most often this is a loss of precision on datetime or float datatypes...

Good luck.

Patrice

--

"Daren Hawes" <[email protected]> a écrit dans le message de Standard. When I dragged the Table from the Server Explorer.

See Below

'

'OleDbConnection

'

Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _

"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""D:\Clients\ABC\Air Train" & _

" (Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb"";Passw" & _

"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Micr" & _

"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Pro" & _

"perties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create " & _

"System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Com" & _

"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False" & _

""

'

'

'OleDbDeleteCommand1

'

Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Reminders WHERE (EventID = ?) AND (ReminderDate = ? OR ? IS NULL AND " & _

"ReminderDate IS NULL) AND (ReminderTime = ? OR ? IS NULL AND ReminderTime IS NUL" & _

"L) AND (Route = ? OR ? IS NULL AND Route IS NULL)"

Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_EventID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EventID", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

'




------------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 8:15 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????




----------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
M

Miha Markic [MVP C#]

HI Daren,

I would modify the Delete command to use only primary key and perhaps a timestamp type of field to do the deletion.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Standard. When I dragged the Table from the Server Explorer.

See Below

'

'OleDbConnection

'

Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _

"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""D:\Clients\ABC\Air Train" & _

" (Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb"";Passw" & _

"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Micr" & _

"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Pro" & _

"perties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create " & _

"System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Com" & _

"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False" & _

""

'

'

'OleDbDeleteCommand1

'

Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Reminders WHERE (EventID = ?) AND (ReminderDate = ? OR ? IS NULL AND " & _

"ReminderDate IS NULL) AND (ReminderTime = ? OR ? IS NULL AND ReminderTime IS NUL" & _

"L) AND (Route = ? OR ? IS NULL AND Route IS NULL)"

Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_EventID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EventID", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

'




------------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 8:15 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????




----------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
P

Patrice

With ADO and Sql Server, you can use the "timestamp" datatype that made the field automatically updated whenever the row is touched. Don't know if you have something similar for Access ?
I should have been less affirmative. I'm still not sure this is the exact problem but it was working this way in ADO (and I suppose this is similar in ADO.NET).

I still suggest to just perform the SELECT query with teh same criterai to see if it returns a row or not. If not this is likely that and giving a close llok to the criteria should allow to find out what goes wrong...

Patrice


--

"Daren Hawes" <[email protected]> a écrit dans le message de Can I turn this feature off?

There is only 1 database per application. No one sharing it!

Also I do not have a date time field, should I?

Thx



------------------------------------------------------------------------------
From: Patrice [mailto:[email protected]]
Posted At: Wednesday, 8 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


These kind of false concurrency detection is AFAIK most often caused by a delete criteria that returns no rows. The assumption is then that someone else changed the row.
Try perhaps to do first a select to see if a row is returned. If not see the SQL statement to find out whay. Most often this is a loss of precision on datetime or float datatypes...

Good luck.

Patrice

--

"Daren Hawes" <[email protected]> a écrit dans le message de Standard. When I dragged the Table from the Server Explorer.

See Below

'

'OleDbConnection

'

Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _

"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=""D:\Clients\ABC\Air Train" & _

" (Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb"";Passw" & _

"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Micr" & _

"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Pro" & _

"perties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create " & _

"System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Com" & _

"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False" & _

""

'

'

'OleDbDeleteCommand1

'

Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Reminders WHERE (EventID = ?) AND (ReminderDate = ? OR ? IS NULL AND " & _

"ReminderDate IS NULL) AND (ReminderTime = ? OR ? IS NULL AND ReminderTime IS NUL" & _

"L) AND (Route = ? OR ? IS NULL AND Route IS NULL)"

Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_EventID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "EventID", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderDate1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ReminderTime1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Route1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

'




----------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 8:15 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????




--------------------------------------------------------------------------
From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Hi I get this error below.
-------------------

An unhandled exception of type 'System.Data.DBConcurrencyException' occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 
D

Daren Hawes

Can I turn this feature off?

There is only 1 database per application. No one sharing it!

Also I do not have a date time field, should I?

Thx

_____

From: Patrice [mailto:[email protected]]
Posted At: Wednesday, 8 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


These kind of false concurrency detection is AFAIK most often caused by
a delete criteria that returns no rows. The assumption is then that
someone else changed the row.
Try perhaps to do first a select to see if a row is returned. If not see
the SQL statement to find out whay. Most often this is a loss of
precision on datetime or float datatypes...

Good luck.

Patrice

--


"Daren Hawes" <[email protected]> a écrit dans le message
de Standard. When I dragged the Table from the Server Explorer.

See Below

'

'OleDbConnection

'

Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _

"ocking Mode=1;Jet OLEDB:Database Password=;Data
Source=""D:\Clients\ABC\Air Train" & _

"
(Sherwell)\AirtrainNotifier\Version1\AirtrainNotifier\bin\ATNotifier.mdb
"";Passw" & _

"ord=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=""Micr" & _

"osoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;Extended Pro" & _

"perties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet
OLEDB:Create " & _

"System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Com" & _

"pact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt
Database=False" & _

""

'

'

'OleDbDeleteCommand1

'

Me.OleDbDeleteCommand1.CommandText = "DELETE FROM Reminders WHERE
(EventID = ?) AND (ReminderDate = ? OR ? IS NULL AND " & _

"ReminderDate IS NULL) AND (ReminderTime = ? OR ? IS NULL AND
ReminderTime IS NUL" & _

"L) AND (Route = ? OR ? IS NULL AND Route IS NULL)"

Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_EventID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "EventID", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderDate",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderDate1",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderDate", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderTime",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ReminderTime1",
System.Data.OleDb.OleDbType.DBDate, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ReminderTime", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Route",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Route1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "Route", System.Data.DataRowVersion.Original, Nothing))

'


_____

From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 8:15 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


How is your OleDbDataAdapter.DeleteCommand configured?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Using the Update feature of the Data Adapter.

IE

OleDbDataAdaptor.fill(dataset) - Works Fine

Insert via Datagrid - Works Fine

OleDbDataAdapter.Update(dataset) - Works Fine

Delete via Datagrid

OleDbDataAdapter.Update(dataset) - ERROR

Have PK and Autonumber set fine. Can delete from Database itself.

?????


_____

From: Miha Markic [MVP C#] [mailto:miha at rthand com]
Posted At: Tuesday, 7 December 2004 6:21 PM
Posted To: microsoft.public.dotnet.framework.adonet
Conversation: Concurrency Issues after a Delete has occurred in Access
Subject: Re: Concurrency Issues after a Delete has occurred in Access


Hi Daren,

You are first deleting and then updating? Shouldn't you insert it and
not update it?


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Hi I get this error below.
-------------------


An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll

Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------------

I am using Access and this only happens when I delete data from a
Dataset and then try to Update it back to the BD.

Adding Works Well and Updating is fine, just deleting.

Any Ideas?

Thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top