DBConcurrencyException when using OleDBTypes DBDate and Double

G

G@z

I'm a total newbie at this - but I am currently writing a vb.net winforms
application which utilises an MS Access database.

When trying to delete rows in my datagrid and post the changes back to the
database, I keep receiving a DBConcurrencyException informing me that no
rows have been deleted.

Through trial and error, I have found that the exception is arises when the
oledbtype of a column is set to "dbdate" or "double". For the time being,
I've worked around the dbdate problem by setting the type to "date". But I
can't seem to find a workaround for the "double" type problem - setting the
type to integer, single and decimal has not helped (even though one of the
other columns in my database has its type set to integer and seems to work).

I have three questions:

1. Has anyone else experienced the same problems?;
2. Is it okay to change the dbdate type to date? (the column is supposed to
record dates in the form of dd/mm/yyyy); and
3. Does anyone have a workaround for the "double" problem or is this a bug
in .net/access?

The following is a copy of my original deletecommand and its parameters
(without the changes to the dbdate types):

'OleDbDeleteCommand1
'
Me.OleDbDeleteCommand1.CommandText = "DELETE FROM TSData2 WHERE
(EntryID = ?) AND (Billed = ?) AND (File = ? OR ? IS NU" & _
"LL AND File IS NULL) AND (Finish = ? OR ? IS NULL AND Finish IS
NULL) AND (Start" & _
" = ? OR ? IS NULL AND Start IS NULL) AND (Summary = ? OR ? IS NULL
AND Summary I" & _
"S NULL) AND ([Time] = ? OR ? IS NULL AND [Time] IS NULL) AND
(TimesheetID = ? OR" & _
" ? IS NULL AND TimesheetID IS NULL) AND (Units = ?)"
Me.OleDbDeleteCommand1.Connection = Me.OleDbConnection1
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_EntryID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"EntryID", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Billed",
System.Data.OleDb.OleDbType.Boolean, 2,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Billed", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_File",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"File", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_File1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"File", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Finish",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Finish",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Finish1",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Finish",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Start",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Start",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Start1",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Start",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Summary",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Summary", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Summary1",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Summary", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Time",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Time",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Time1",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Time",
System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_TimesheetID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"TimesheetID", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_TimesheetID1",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"TimesheetID", System.Data.DataRowVersion.Original, Nothing))
Me.OleDbDeleteCommand1.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Units",
System.Data.OleDb.OleDbType.Double, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "Units",
System.Data.DataRowVersion.Original, Nothing))
'

TIA
 
D

David Sceppa

G@z,

I haven't seen this behavior before. Could you describe the schema
for the Access table so I can try to reproduce the problem?

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2005 Microsoft Corporation. All rights reserved.
 

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