D
Dr. Know
I am working on an ASP page that writes to several databases, ranging
from MDBs to x-base.
One of the tasks involves using an existing highest value from the DB
and incrementing it before inserting a new record.
I am using Application.Lock and .Unlock together with an application
variable to negotiate access to the DB routine to one session (user)
at a time. This is to ensure that the ID numbers are cleanly
incremented, and that no two records has the same ID. These databases
are also written to by a console user app (non-asp). The exclusive
access to the DB *generally* lasts WAY less than 1 second.
But because of the variable nature of things computer related, I have
error trapping in the code that detects a DB open or execute error,
and waits n period of time, and tries again - for a maximum of x
tries. (n is about 1 second, and x is 5 tries)
My problem is in pausing the script. I am a newbie at this, so be
gentle if this is a really stupid question.
You cannot use:
d - duration
x = time
do while time < (x + d)
.... (what, no doevents?)
loop
as it consumes vast amounts of CPU cycles.
There is no Sleep Function, I was amazed to learn.
There is no doevents, to release a dumb loop as above from hogging CPU
time.
I have had no luck in using the WScript.Sleep business....
I'm not quite sure how to reference it.
Is there a better approach to this?
Thanks,
Greg
Dr. Know
from MDBs to x-base.
One of the tasks involves using an existing highest value from the DB
and incrementing it before inserting a new record.
I am using Application.Lock and .Unlock together with an application
variable to negotiate access to the DB routine to one session (user)
at a time. This is to ensure that the ID numbers are cleanly
incremented, and that no two records has the same ID. These databases
are also written to by a console user app (non-asp). The exclusive
access to the DB *generally* lasts WAY less than 1 second.
But because of the variable nature of things computer related, I have
error trapping in the code that detects a DB open or execute error,
and waits n period of time, and tries again - for a maximum of x
tries. (n is about 1 second, and x is 5 tries)
My problem is in pausing the script. I am a newbie at this, so be
gentle if this is a really stupid question.
You cannot use:
d - duration
x = time
do while time < (x + d)
.... (what, no doevents?)
loop
as it consumes vast amounts of CPU cycles.
There is no Sleep Function, I was amazed to learn.
There is no doevents, to release a dumb loop as above from hogging CPU
time.
I have had no luck in using the WScript.Sleep business....
I'm not quite sure how to reference it.
Is there a better approach to this?
Thanks,
Greg
Dr. Know