Posted on: 12/10/2014 10:19:31 PM | Views : 514

Hi all,
Is this code okay considering opening and closing db connection.
I dont know if connection will be closed or not because in the first try-catch block there is response redirect.
Will page be redirected and the rest of the code executed or when redirect happens rest of the code is ignored and connection stays opened??
Thanks
dbveza.Open(); SqlTransaction trans = dbveza.BeginTransaction(); naredba.Transaction = trans; updatepart.Transaction = trans; try { updatepart.ExecuteNonQuery(); naredba.ExecuteNonQuery(); Session.Remove("COUNTRY"); Session.Remove("OLDISO"); trans.Commit(); Response.Redirect("~/Countries.aspx"); } catch (SqlException ex) ...

Go to the complete details ...