Executing UPDATE SQL command doesnot update the database immediately.

V

Venu Koduru

After updating a field with a certain value, If I try to
retrieve those updated records I donot get all the records
which were just updated.
If I put a Sleep(1000) command then it works properly.
But on a very fast machine I need to change the Sleep
parameter.

This is what I am doing:
After I update a field with a value for example (UPDATE
testinstance ti SET TEST_VALUE = 5 WHERE ti.test_ID <10)
let's say 10 records were updated.
Now if I try to retrieve those updated records
(select * from testinstance where test_value =5)
it doesnot retrive all the updated records, some time it
retrieves only 7 records.

But If I put a sleep command before retrieving then I get
all the 10 records.

It looks like access or jet engine returns to the next
statement before actually updating the database.

I am running these SQL commands on the same ADO connection
object using ADO's Execute method.

I appreciate your help.

Thanks
Venu
 
G

Gary Miller

Venu,

Try putting in a DoEvents line between your Update and your Select. This
usually will allow the computer to complete the first command before
initiating the next one.

Gary Miller
 

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