Freigeben über


CommitTransaction-Methode

Commits the current transaction on the referenced connection.

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

Syntax

'Declaration
Public Sub CommitTransaction
'Usage
Dim instance As ServerConnection

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

Beispiele

C#

ServerConnection conn = new ServerConnection();
conn.DatabaseName = "AdventureWorks2008R2";
conn.BeginTransaction();
conn.ExecuteNonQuery("CREATE TABLE TABLE1(d int, name varchar(32));")
conn.CommitTransaction();

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
$conn.DatabaseName = "AdventureWorks2008R2"
$conn.BeginTransaction()
$conn.ExecuteNonQuery("CREATE TABLE TABLE1(d int,name varchar(32));")
$conn.CommitTransaction()