DB transaction impossible in ASP.NET ?

  • Thread starter Maris Janis Vasilevskis
  • Start date
M

Maris Janis Vasilevskis

Hi,

I wish to initiate a transaction and commit or rollback some screens later.
I could not find a solution.
The simplest idea,
ViewState["MyTransaction"]=MyTransaction
, fails because ODBCTransaction is not serializable.

Any suggestions?

Thank you,
Mahris
 
B

Brendan Green

The web is stateless. Each page knows nothing of any preceeding pages,
including any transactions that you have started.

One suggestion would be to collect the data across multiple pages, then on
the last page do all the data access, and either commit or rollback the
transaction there.

Even if you were able to serialize the transaction object across multiple
pages (as you attempted below) you'll run into problems when a user decides
to sit on a page for an extended period of time, in which case you could be
looking at timeout errors.
 
R

Ray Booysen

Maris said:
Hi,

I wish to initiate a transaction and commit or rollback some screens later.
I could not find a solution.
The simplest idea,
ViewState["MyTransaction"]=MyTransaction
, fails because ODBCTransaction is not serializable.

Any suggestions?

Thank you,
Mahris
As said in another reply, this isn't the best option.

Transactions are possible, but not across screens. Your best bet would
be to collect the data in session and then update the db in your last
screen.

Regards
Ray
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top