DB transaction impossible in ASP.NET ?

  • Thread starter Thread starter Maris Janis Vasilevskis
  • Start date 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
 
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.
 
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
 
Back
Top