Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADO, Transaction and ASP

Posted on 2004-09-03
3
Medium Priority
?
384 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
leorich2001 earned 500 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Make the most of your online learning experience.
Progress
Introduction to Processes

722 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