D
Daren Hawes
Hi,
I am using access as the main DB for an application.
Whenever I try to update the DB by my Dataset I get Exception below.
--------------
An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll
Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------
What worries me is the "?" in the SQL below of the Update Command? Is
this normal?
I just cannot get my head around the "?"
All the code below was generated by Visual Studio.
Do I have to modify this or am I doing something Wrong?
Thanks in Advance.
'OleDbUpdateCommand1
'
Me.OleDbUpdateCommand1.CommandText = "UPDATE Reminders SET ReminderDate
= ?, ReminderTime = ?, Route = ? WHERE (EventID" & _
" = ?) AND (ReminderDate = ? OR ? IS NULL AND ReminderDate IS NULL) AND
(Reminder" & _
"Time = ? OR ? IS NULL AND ReminderTime IS NULL) AND (Route = ? OR ? IS
NULL AND " & _
"Route IS NULL)"
Me.OleDbUpdateCommand1.Connection = Me.OleDbConnection
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("ReminderDate",
System.Data.OleDb.OleDbType.DBDate, 0, "ReminderDate"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("ReminderTime",
System.Data.OleDb.OleDbType.DBDate, 0, "ReminderTime"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Route",
System.Data.OleDb.OleDbType.VarWChar, 50, "Route"))
Me.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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))
'
I am using access as the main DB for an application.
Whenever I try to update the DB by my Dataset I get Exception below.
--------------
An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll
Additional information: Concurrency violation: the DeleteCommand
affected 0 records.
--------------
What worries me is the "?" in the SQL below of the Update Command? Is
this normal?
I just cannot get my head around the "?"
All the code below was generated by Visual Studio.
Do I have to modify this or am I doing something Wrong?
Thanks in Advance.
'OleDbUpdateCommand1
'
Me.OleDbUpdateCommand1.CommandText = "UPDATE Reminders SET ReminderDate
= ?, ReminderTime = ?, Route = ? WHERE (EventID" & _
" = ?) AND (ReminderDate = ? OR ? IS NULL AND ReminderDate IS NULL) AND
(Reminder" & _
"Time = ? OR ? IS NULL AND ReminderTime IS NULL) AND (Route = ? OR ? IS
NULL AND " & _
"Route IS NULL)"
Me.OleDbUpdateCommand1.Connection = Me.OleDbConnection
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("ReminderDate",
System.Data.OleDb.OleDbType.DBDate, 0, "ReminderDate"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("ReminderTime",
System.Data.OleDb.OleDbType.DBDate, 0, "ReminderTime"))
Me.OleDbUpdateCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Route",
System.Data.OleDb.OleDbType.VarWChar, 50, "Route"))
Me.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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.OleDbUpdateCommand1.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))
'