473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Locking a table to stop duplicate updating

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
Mar 23 '06 #1
3 1696

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.

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?


You could try making it a scheduled task.
--
Mike Brind

Mar 23 '06 #2
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.
Mar 23 '06 #3
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eG**************@TK2MSFTNGP11.phx.gbl...
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.

Thanks for this. I've just done my crash course on SQL Server Agent and
Stored Procedures! I am using SQL Server 2000.

I think I understand that:
1 SQL Server Agent would invoke a Stored Procedure once a day.
2 The Stored Procedure would
a) Select the email addresses from the records for which subscriptions
were due and
b) Update the records to indicate that the emails had been scheduled.
But how do I send the emails? With ASP or SSA? I can see how to get the
record set to an ASP page if that page invokes the stored procedure but how
do I do that when the stored procedure is invoked by SSA? Or does SSA send
the emails?

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Mar 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Nid | last post by:
How do I do row-level locking on SQL Server? Thanks, Nid
7
by: Bing Wu | last post by:
Hi Folks, I have a very large table containing 170 million rows of coordinats: CREATE TABLE "DB2ADMIN"."COORDINATE" ( "FID" INTEGER NOT NULL , "AID" INTEGER NOT NULL , "X" REAL NOT NULL ,...
1
by: Vikky | last post by:
Hi All: I have a problem with DB2 locking scheme. I am dealing with two processes modifying the DBMS (here IBM DB2 7.1 FP8 on Solaris) simulteneously. P1: Huge transactional data being...
2
by: Ray | last post by:
I have a list of about 20,000 rows that I am updating. I loop through each row in my program and basically do the following (1) select * from TABLE where SID= for update /*lock the row*/ (2)...
5
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone |...
1
by: Syn | last post by:
Hello, I have a parent table(x_orders) and a child table(x_orders_contents), with a cascade delete on the child table. In a after delete trigger of the x_orders_contents table I'm updating a...
3
by: Brad Pears | last post by:
I have a vb.net 2005 app that asks for a job number. After the job number has been entered, I run an SQL 2000 stored procedure that selects the appropriate row from the Jobs table. I do not want to...
1
by: gurmet | last post by:
Hi All I have been looking around for help, and finally post this problem. I created a form to edit a record. Before i can click save button on the edit form i need to check if the data that...
3
by: kstevens | last post by:
I have turned on record locking do to the fact that we are starting to have issues with the records not being locked. I have a button on a form that changes the recordsource of the form. When i...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.