Solved

ADO, Transaction and ASP

Posted on 2004-09-03
3
379 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

813 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

16 Experts available now in Live!

Get 1:1 Help Now