Partilhar via


Método ServerConnection.CommitTransaction

Commits the current transaction on the referenced connection.

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

Sintaxe

'Declaração
Public Sub CommitTransaction
'Uso
Dim instance As ServerConnection

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

Exemplos

C#

ServerConnection conn = new ServerConnection();
conn.DatabaseName = "AdventureWorks2012";
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 = "AdventureWorks2012"
$conn.BeginTransaction()
$conn.ExecuteNonQuery("CREATE TABLE TABLE1(d int,name varchar(32));")
$conn.CommitTransaction()

Consulte também

Referência

ServerConnection Classe

Namespace Microsoft.SqlServer.Management.Common

Outros recursos

Usando transações