Solved

ADO, Transaction and ASP

Posted on 2004-09-03
3
377 Views
Last Modified: 2008-02-01
Hi,

I've never used ado transactions before.
I will use it on asp pages.
So, can anybody correct my understanding, please?

1) my asp pages always open an ado connection at the begining,
and close the connection at the end.
Between open and close the connection, it executes DMLs and/or pass the connection to some recordsets.
So, as long as I use this connection, I can handle a transaction ?
I mean an ado transaction always belong to an connection?
And all I have to do is
to put conn.BeginTrans, define a flag, call conn.CommitTran or conn.RollbackTran.
Is it true?

2) what will happens if I call rs.update with adDynamic cursor type in a transaction?
Can the change be seen from others before committing the transaction?

3) About lock,
an asp inserts records into some tables
and updatess records in some tables in a transaction.
all the tables or pages locked until the changes are commited or rollbacked?
0
Comment
Question by:masa2004
  • 2
3 Comments
 

Accepted Solution

by:
leorich2001 earned 125 total points
ID: 11972530
1) my asp pages always open an ado connection at the begining,
and close the connection at the end.

no, It will open connection when neccesarry and close the connection as soon as possible.

Between open and close the connection, it executes DMLs and/or pass the connection to some recordsets.

So, as long as I use this connection, I can handle a transaction ?
yes you can

I mean an ado transaction always belong to an connection?
yes it is

And all I have to do is
to put conn.BeginTrans, define a flag, call conn.CommitTran or conn.RollbackTran.
Is it true?
yes
but please ensure that the process between transaction is as little as you can , so that you would have good performance

2) what will happens if I call rs.update with adDynamic cursor type in a transaction?
the table will be locked temporarirly, so no one can not read the table until you commit or rollback

Can the change be seen from others before committing the transaction?
No, It can't

3) About lock,
an asp inserts records into some tables
and updatess records in some tables in a transaction.
all the tables or pages locked until the .... EXACTLY
0
 

Author Comment

by:masa2004
ID: 11975447
leorich2001,

Let me make sure two things,

>no, It will open connection when neccesarry and close the connection as soon as possible.
does you mean, automatically open/close connection is handled by ado?
I EXPLICTLY call conn.open at the beginning and conn.close at the end in an asp page.
Is this approch ok? or do I need to call open/close more frequently in the middle of asp pages?

And,
>all the tables or pages locked until the .... EXACTLY
I believe that there are Optimistic lock and Pessimistic lock for recordset.
But in a transaction, ado seems using only pessimistic lock. Is it right?

Thanks.
0
 

Author Comment

by:masa2004
ID: 11993435
I got enough answer from leorich2001,
I left small questions though.

Thanks.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now