Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2.0: transaction on ASP.NET page

0 views
Skip to first unread message

RAM

unread,
Aug 7, 2006, 9:58:45 AM8/7/06
to
Hello,
I am learning .NET. I am writing database application which contains some
operations accessible from ASP.NET menu. This operations should be separate
transactions.
I wrote:

public partial class PZ : System.Web.UI.Page
{
bool Commited;
protected void Page_Load(...)
{
if (!IsPostBack)
{
Cache["Transaction"] = Admin.Conn.BeginTransaction["PZ"];
Commited = false
}
}
protected void Save_Click(...)
{
SqlTransaction t = (SqlTransaction)Cache["Transaction"];
if (t != null)
t.Commit();
Commited = true;
}
}

I don't know where to put Rollback code. I cannot do it in Page_Unload
because page is reloaded because of list box control.
Could you give me some suggestion how to do it?
Thank you
/RAM/


0 new messages