Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

placing delay before executing to the next line of code

Status
Not open for further replies.

zyrag

IS-IT--Management
Dec 4, 2002
252
0
0
PH
How can i place a delay for the execution of codes in the background? Something like a sleep (ms), if there exist a command. The purpose is to allow the completion of multiple data inserts to the server before the execution of the next line of codes. Please share your tricks.
 
Calls to ADO in VB6 is synchronous, so your code won't continue to execute until you return from the database call. There should be no need to use a "sleep" method between database calls.

If you're taking up too much of the database CPU, then I would look at optimizing your queries first.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Hi chip,

here's the scenario..

I have an INSERT INTO tbl (fld1,fld2..) SELECT fld1,fld2..
command. After the execution (Conn.Execute), the next line of code is to open a recordset containing the same set of data as inserted. Without a delay, the recordset would only return partial no. of records or none at all coz all records have not been completely inserted. So, i would try to place a delay in between like this:

INSERT INTO ...

Delay_Proc 5 '(5 secs delay)

objRec.Open strSQL, ....


I hope this made clear with what i really wanted to do.

Thanks.
 
Luckily, i was able to find solution using the Sleep API.
 
You've got something wrong somewhere in the environment -- I would start looking why those rows are not visible after being inserted. Because they should be.

When your transaction is committed (you *are* using transactions, right?) the data is supposed to be available to all database users by virtue of the classic relational database ACID properties.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Also, if you should probably be looking at pesimistic locking on the table. While one user or process has the table open, nothing else can open it until the user or process has completed and released the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top