Aracılığıyla paylaş


ServerConnection.BeginTransaction Method

Starts a transaction on the referenced connection.

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

Syntax

'Bildirim
Public Sub BeginTransaction
'Kullanım
Dim instance As ServerConnection

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

Examples

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

See Also

Reference

ServerConnection Class

Microsoft.SqlServer.Management.Common Namespace

Other Resources

Using Transactions