Condividi tramite


Metodo BeginTransaction

Starts a transaction on the referenced connection.

Spazio dei nomi  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

Sintassi

'Dichiarazione
Public Sub BeginTransaction
'Utilizzo
Dim instance As ServerConnection

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

Esempi

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