摘要:
SqlConnection con =new SqlConnection(ConnectionDb.conStr);//获取数据库连接 con.Open();//打开连接 SqlTransaction sqltra = con.BeginTransaction();//开始事务 SqlCommand cmd =new SqlCommand();//实例化 cmd.Connection = con;//获取数据连接 cmd.Transaction = sqltra;//,在执行SQL时,try { ... 阅读全文