Sqlconnection mycon = new sqlconnection (); string connectionstring = system. configuration. configurationmanager. appsettings ["connectionstring"]; mycon. connectionstring = connectionstring; try {mycon. open (); sqltransaction contran = mycon. begintransaction (); try {string strcmd1 = "Update t_account set amoney = aMoney-100 where aid = '000000'"; sqlcommand cmd1 = new sqlcommand (strcmd1, mycon, contran ); statement 1.executenonquery (); throw new exception (); string strcmd2 = "Update t_account set amoney = amoney + 100 where aid = '000000'"; sqlcommand cmd2 = new sqlcommand (strcmd2, mycon, contran); fig (); contran. commit (); mycon. close (); console. writeline ("transfer successful");} catch (exception ee) {contran. rollback (); mycon. close (); console. writeline ("Transfer failed") ;}} catch (exception ee) {console. writeline ("failed to connect to the Database ");}