Transaction block

O

Ori

Hi,

I have a wired problem.

I have a code block in my code (ASPX file) which I need to force it to
be transactional.

I'm doing the following:

1. for each one of the items
i. Add record to the table which indicate that a transaction has been
completed successfully. (X)
ii. Set a variable inside the object which flag that the user already
pay (Y)
2. Set the object inside the session.


My problem is what happen if my code is failed between X & Y. In this
case I already "charge" the user in the database, but I didn't set the
flag which indicate that the user already pay for the service.

Do I have a way to force those to lines to be under the same
transaction? Or any better idea to solve this problem?

Thanks,

Ori.
 
G

Guest

Try if MTS Transactions in .NET can help you with this(I doubt it will)

http://samples.gotdotnet.com/quickstart/aspplus/doc/mtstransactions.asp

I think you have to handle this in your own way

Suresh

----- Ori wrote: ----

Hi

I have a wired problem

I have a code block in my code (ASPX file) which I need to force it t
be transactional

I'm doing the following

1. for each one of the item
i. Add record to the table which indicate that a transaction has bee
completed successfully. (X
ii. Set a variable inside the object which flag that the user alread
pay (Y
2. Set the object inside the session


My problem is what happen if my code is failed between X & Y. In thi
case I already "charge" the user in the database, but I didn't set th
flag which indicate that the user already pay for the service

Do I have a way to force those to lines to be under the sam
transaction? Or any better idea to solve this problem

Thanks

Ori
 
M

Malek

You doubt it ? can you explain why ? and what exactly do you doubt ?

Actually, although I never used MTS (call it MTS, COM+ or Enterprise
Services, as you like) on a web page directly, I have often used Serviced
Components and even COM+ Services without Components (COM+1.5) for scenaios
not very far from this, and it does work ... I don't see why it wouldn't on
a Web page ...
 
S

Suresh

Malek,

If you've used MTS in ASP.NET please put up an example instead of asking me
why it doesn't work. We are here to help each other out and if you know of
a way it works; instead of debating my solution, please provide the right
solution. Your correction/solution will be understood and appreciated.

Since you admitted you haven't done this in a web application scenario
specifically in ASP.NET don't assume it works.

For your information: (Here's what I based my statement on)
I tried using MTS transactions in ASP.NET with file writes and database
inserts in a transaction and IT DID NOT work. To be clear I write a file to
a file server then have to insert a record into the database with
information about that file. If the database insert failed then the file
that was written needed to be deleted or rolledback. This did not work with
MTS transactions enabled using SetAbort/SetComplete. I had to handle this
on my own. May be I didn't use it correctly and that's the reason it
failed. I followed the documentation in the following link,
http://samples.gotdotnet.com/quicks...=/quickstart/aspplus/doc/mtstransactions.aspx

NOTE: This is where you can help us show what I may have done wrong or even
show us the correct way to do it.

Continuing on..
I did a test ASP.NET application where I ran 2 updates to 2 different DB
servers with MTS transactions to see if it would rollback if the second
update failed. MTS worked fine here as it successfully rolled back the
first insert. But when transactions involved something other than the just
DB inserts or updates it didn't work.

Thus my doubt that it will work in Ori's scenario. I hope that makes it
clear for you.

I understand my scenario is a little different than Ori's. But he's talking
about writing to an object and then to session and inserting db records all
which should be enveloped in a transaction. In that sense writing files and
inserting records into a DB in my scenario is not all that different.

Even then; you probably noticed in my reply post, I did gave Ori the link to
using MTS transactions in ASP.NET. I left it up to him to atleast try it
out.

Suresh.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top