Monday, October 11, 2010

c # in the transaction, batch submission, the wording of rollback



public void UpdateContactTableByDataSet (DataSet ds, string strTblName)

(

try

(

SqlDataAdapter myAdapter = new SqlDataAdapter ();

SqlConnection conn = new SqlConnection (strConnection);

SqlCommand myCommand = new SqlCommand ("select backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp from strTblName", conn);

myAdapter.SelectCommand = myCommand;

SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder (myAdapter);

conn.Open ();

SqlTransaction myTrans = conn.BeginTransaction ();

myCommand.Transaction = myTrans;

try

(

myAdapter.Update (ds, strTblName);

myTrans.Commit ();

)

catch (Exception e)

(

try

(

myTrans.Rollback ();

)

catch (SqlException ex)

(

if (myTrans.Connection! = null)

(

Console.WriteLine ("Rollback failed! Exception type:" + ex.GetType ());

)

)

)

finally

(

conn.Close ();

)

)

catch (Exception ex)

(

throw ex;

)

)







Recommended links:



VOB to Zune



ASF converter



VOB To MPG



where to hide your hidden Camera



No comments:

Post a Comment