sqlhelper 使用事务实例

string myConnectString = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30";

SqlConnection myConnection = new SqlConnection(myConnectString);
myConnection.Open();
SqlTransaction st = myConnection .BeginTransaction();
try
{
...
SqlHelper.ExecuteDataset(st,...);
SqlHelper.ExecuteDataset(st,...);
...
st.Commit();
}
catch(SqlException ee)
{
st.Rollback();
throw ee;
}

posted @ 2009-06-29 17:13  与时俱进  阅读(586)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈