Is there a difference SMO ServerConnection transaction methods versus using the SqlConnectionObject

Posted by YWE on Stack Overflow See other posts from Stack Overflow or by YWE
Published on 2010-06-16T22:16:57Z Indexed on 2010/06/16 22:22 UTC
Read the original article Hit count: 318

Filed under:
|
|
|

I am using SMO to create databases and tables on a SQL Server. I want to do so in a transaction. Are both of these methods of doing so valid and equivalent:

First method:

Server server;
//...
server.ConnectionContext.BeginTransaction();
//...
server.ConnectionContext.CommitTransaction();

Second method:

Server server;
// ...
SqlConnection conn = server.ConnectionContext.SqlConnectionObject;
SqlTransaction trans = conn.BeginTransaction();
// ...
trans.Commit();

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET