Share via


ServerConnection.RollBackTransaction Method

Rolls back the current transaction.

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

Syntax

'Declaration
Public Sub RollBackTransaction
'Usage
Dim instance As ServerConnection

instance.RollBackTransaction()
public void RollBackTransaction()
public:
void RollBackTransaction()
member RollBackTransaction : unit -> unit
public function RollBackTransaction()

Examples

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()

See Also

See Also

Reference

ServerConnection Class

Microsoft.SqlServer.Management.Common Namespace