-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: rags_rao
Message 3 in Discussion
same transaction object has to be used for all database access
conn.Open();
OleDbTransaction trans = conn.BeginTransaction();
try
{
function1(trans/conn); //use same connection for all DB access
obj.function2(trans);
....................
trans.Commit();
}
catch{trans.Rollback();}
finally{conn.Close();}
Regards,
Raghunandan R,
Software Engineer,
Nous Infosystems,
#1,1st main,1st block,kormangala,bangalore - 560034.
ph: +91-80-553 4208/552 2086
-----Original Message-----
From: dinesh_gr [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 03, 2004 5:39 PM
To: BDOTNET
Subject: Handling Transactions in ADO.net
New Message on BDOTNET
Handling Transactions in ADO.net
Reply
Reply to Sender Recommend Message 1 in Discussion
From: dinesh_gr
Hi all...
I have a query reg Transactions.....
I write the following code in Test.aspx.vb page..
All the transactions are hanled in the front end ..ie SqlTransaction
object...
The following code executes in the button click...
Dim Code as string
Dim x as new Class1()
x.insertvalue(10) -- I insert some value....
--Class1 does some DataBase operatios and give the value back
to the code behind...
Code = x.getValue() -- Based on the insertion,the class method also
returns
some values to the front end.
In Class1 I am using the SqlTransaction object...ie
BeginTransaction and Commit..
Based on Class1 value, I create an object of Class2()...
Dim y as new Class2() --
y.InsertValue(Code) - I pass the (Code) value got from the Class2 and
i again do some DB operations ...ie Insert operations.... Here also ,
transaction is handled...BeginTransaction and Commit...
My Queries are:
1. If any error occurs while inserting the data in Class2..., the data which
has already been inserted and commmited in Class1, will be whether rolled
back or not...
2. How do i handle transaction for this code....ie to which one should i
associate my SqlTransaction object...becasuse all the interactions with the
DB are done inside Class1 and Class2.Ho do i handle the transactiosn ih teh
front end...
Pls do give me ur valuable suggestions...
Regards,
Dinesh.
View other groups in this category.
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily
Horoscopes
To stop getting this e-mail, or change how often it arrives, go to your
E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member
Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On
the pre-addressed e-mail message that opens, simply click "Send". Your
e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from BDOTNET.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]