ADO corrupts date time values in where clause
Posted on 2006-11-16
We have a propreitary application similar to VB that uses ADO for talking to an Oracle database. We use ORaoledb.oracle as the provider.
At times we are getting error messages like "Row cannot be located for updating" and sometimes ORA-01841 Invalid date.
This error does not happen to all the users. But once it starts occuring for a user, it's persistent till the time user logs out and logs back into the application.
We were able to do an oracle trace and identify the sql statements that were causing this.
In some cases we see that the year component of a date field in the where clause being chopped off. This happens only in fields where date is 30-DEC-1899.
(ie) instead of passing 1899-12-30 09:30:00 it passes -12-30 09:30:00. This throws the invalid date format error.
Also in some cases the time component seems to be offset by 10 secs (ie) In the database if the time component of a date field is 00:00:00, ado passes 00:00:10 in the where clause. Thus causing the unable to locate row error.
Now all these are in the where clause.Since the where clause is something that ADO builds, we are at a loss as to what's going on.
The values for the same fields (used in the set protion of the update) passed from the application are in correct format.
Any ideas or thoughts welcome.