Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ADO corrupts date time values in where clause

Posted on 2006-11-16
7
Medium Priority
?
487 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:sathyagiri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 14

Author Comment

by:sathyagiri
ID: 17960788
Also is there a way to trace the ADO calls?
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17964262
What is the data type of that table field?

Also try to post the portion of your code where you actually build the where clause
0
 
LVL 14

Author Comment

by:sathyagiri
ID: 17965079
The application does not build the where clause. We just select a record and modify the values and call ADO UPDATE.

ADO seems to be generating the where clause with all the columns in the table.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17977069
>>The application does not build the where clause
Please provide the SQL code segment you are using. This will be helpful for us to debug
0
 
LVL 14

Author Comment

by:sathyagiri
ID: 17979145
Here's what we do

ADO select * from table where <condition>

ADO FINDFIRST <table>

-- Set new values here
ADO UPDATE <context> ALL

0
 
LVL 5

Accepted Solution

by:
RainUK earned 1500 total points
ID: 17986148
"Row cannot be located for updating"  - The error you are getting usually comes from when you select a set of rows and whilst you are reading and modifying them in your version of the cursor, somebody else makes an update to the rows you have selected.

Hence when you go to update them you get the error that the rows cannot be found for updating.

Basically the (Row Version) property in ADO has changed since you last read the rows because somebody else has updated or deleted the rows in the DB.

As for the date thing, not sure what your code does to update the date, but you can format the date in either VB6 or T-SQL into a certain format before updating it.
0
 
LVL 14

Expert Comment

by:Shiju Sasidharan
ID: 17993227
>>ADO UPDATE <context> ALL

simply seeing the algorithm we can not predict the exact error.
Please try to post the exact source code segment for the same
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question