프로그램 세상/ASP.NET

소년포비 2009. 10. 24. 02:11

SqlCommection Con = new SqlConnection ();
Con.ConnectionString = "server=(local); database=Pubs ...";
Con.Open ();

SqlTransaction trans = Con.BeginTracsaction ();

SqlCommand Cmd = new SqlCommand ();
Com.Connection = Con;

Cmd.Transaction = trans;

try
{
        string Sql;

        처리 로직

        trans.Commit ();
}
catch (Exception ex)
{
        trans.Rollback ();
}
finally
{
        Con.Close ();
}