473,422 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,422 software developers and data experts.

Transaction block

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.
Nov 18 '05 #1
3 2257
Try if MTS Transactions in .NET can help you with this(I doubt it will)

http://samples.gotdotnet.com/quickst...ansactions.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

Nov 18 '05 #2
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 ...

"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Try if MTS Transactions in .NET can help you with this(I doubt it will).

http://samples.gotdotnet.com/quickst...nsactions.aspx

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 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.

Nov 18 '05 #3
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/quickst...nsactions.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.
"Malek" <ke****@arrabeta.com> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
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 ...

"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Try if MTS Transactions in .NET can help you with this(I doubt it will).

http://samples.gotdotnet.com/quickst...nsactions.aspx

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

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.


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Arnaud | last post by:
Hi, I have a script which inserts some rows in an InnoDB table. I want to be sure that all the rows are inserted, so i use a mysql transaction ("start transaction", insertions, and "commit"). ...
7
by: Abdul-Wahid Paterson | last post by:
Hi, I have had a site working for the last 2 years and have had no problems until at the weekend I replace my database server with a newer one. The database migration went like a dream and I had...
6
by: Chris Ochs | last post by:
I want to do a series of inserts within a single transaction block, but with postgresql if one insert fails, the whole block is aborted. Is there any way to get around this behavior so that...
2
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
15
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried)...
2
by: Dano | last post by:
Hi all! Perhaps a wise soul can help me here. I have an insert routine for an ASP.Net application and it works fine, but I decided to test the transaction rollback capabilities by stopping the...
2
by: ruben | last post by:
Hi: After upgrading 7.4.2 to 7.4.5 quite smoothly in a Red Hat 8.0 box, we are having intermitent issues with certain online PHP transactions, returning this error: "Warning: pg_exec() query...
3
by: joshsackett | last post by:
I am redesigning an application that distributes heldesk tickets to our 50 engineers automatically. When the engineer logs into their window a stored procedure executes that searches through all...
2
by: ntech | last post by:
hi, This is the error that we are getting on postgresql. The error is as follows: current transaction is aborted. queries ignored until end of the transaction block. What might be the real...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.