ServerConnection.RollBackTransaction 方法
回復目前的交易。
命名空間: Microsoft.SqlServer.Management.Common
組件: Microsoft.SqlServer.ConnectionInfo (在 Microsoft.SqlServer.ConnectionInfo.dll 中)
語法
'宣告
Public Sub RollBackTransaction
'用途
Dim instance As ServerConnection
instance.RollBackTransaction()
public void RollBackTransaction()
public:
void RollBackTransaction()
member RollBackTransaction : unit -> unit
public function RollBackTransaction()
範例
C#
ServerConnection conn = new ServerConnection();
conn.DatabaseName = "AdventureWorks2012";
conn.BeginTransaction();
conn.ExecuteNonQuery("CREATE TABLE TABLE1(d int, name varchar(32));")
conn.RollBackTransaction();
PowerShell
$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$conn.DatabaseName = "AdventureWorks2012"
$conn.BeginTransaction()
$conn.ExecuteNonQuery("CREATE TABLE TABLE1(d int,name varchar(32));")
$conn.RollBackTransaction()
另請參閱