|
Home > Archive > IIS ASP > March 2006 > Locking a table to stop duplicate updating
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Locking a table to stop duplicate updating
|
|
| Roger Withnell 2006-03-25, 11:58 am |
| I have a framed website.
I plan to include in default.asp a routine to check if the annual
subscription is due from the records in the People table.
If so, then the routine would send emails to those who are due and update
the table that this had been done, so that it is only done once.
If session 1 is doing just this, session 2 (and 3 and n) could be doing the
same thing.
Does adLockPessimistic stop this duplication? It seems that this only stops
the table being updated by session 2; it doesn't stop session 2 querying the
table, seeing that subscriptions are due, then updating the table and
sending
the same emails as session 1 when it unlocks the table.
Should I approach this requirement by a different method?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
| |
| Bob Barrows [MVP] 2006-03-25, 11:59 am |
| Roger Withnell wrote:
> I have a framed website.
>
> I plan to include in default.asp a routine to check if the annual
> subscription is due from the records in the People table.
What database? Type and version please. This information is almost always
relevant.
>
> If so, then the routine would send emails to those who are due and
> update the table that this had been done, so that it is only done
> once.
>
> If session 1 is doing just this, session 2 (and 3 and n) could be
> doing the same thing.
>
> Does adLockPessimistic stop this duplication?
Yes. This should be avoided if you want your site to scale well, but
sometimes it cannot be avoided.
In this case, I believe it can be avoided ...
> It seems that this
> only stops the table being updated by session 2; it doesn't stop
> session 2 querying the table, seeing that subscriptions are due, then
> updating the table and sending
> the same emails as session 1 when it unlocks the table.
How have you reached this conclusion? Have you tested it?
adLockPessimistic should lock the table, preventing updates from other
users. That's the definition of "pessimistic locking"
>
> Should I approach this requirement by a different method?
>
I would suggest doing this as a scheduled task outside of asp. If using SQL
Server, simply schedule a SQL Agent job to run periodically. If Access, then
you will need to use the scheduler provided by the operatiing system to
schedule a vbscript file. see: http://www.aspfaq.com/show.asp?id=2143
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
|
|
|
|
|