OLEDB Date and JET 4.0 Bug?

  • Thread starter Thread starter Phil Cox
  • Start date Start date
P

Phil Cox

Hi All,
Wondering if anyone else had encountered this problem. As
an English based country our date format is dd-mm-yyyy
format. This has always been a bit of an issue with Jet as
natively it expects mm-dd-yyyy. However, I have struck a
problem with the OLEDBPRovider in .net 2003 whereby I can
insert records with dates in excess of 12 Oct 2003 fine (I
have a number of date fields in this particular record),
however if I then go to modify that same record and call
dataadapter.update on the dataset I get an error:

Concurrency violation: the UpdateCommand affected 0
records.

I have traced this to records that have dates like 30 Oct
2003 which when I view the changed rows in the dataset is
being recorded as 10/30/2003 in the debug watch window.
While I can overcome this by manually writing my own
update sql command I guess, I do believe there is an
international datetime bug here.

Comments anyone?

(e-mail address removed)
 
False alarm, the real problem is a bit more tricky. It was
actually a double field causing the problem. While the
data adapter wizard honors the default settings (ie
default value of 0) of the fields when it creates the
dataset and associated code from a jet database, the
automatic update query it generates does not, so the end
result is an insert works fine (although no default value
is established unless you code for it) but the update
fails because unless the field has a value in it (ie it is
still NULL) the update will fail as the code is only
generated for a value. It assumes the default value has
been applied. Basic rule, dont rely on Jet engine to set
defaults and dont establish the database with defaults as
it wont work if you leave the fields in a NULL state when
you later attempt to update the records.

HTH someone.

Phil
 
Back
Top