junoob.blogg.se

Alternative to netdrive 2
Alternative to netdrive 2






alternative to netdrive 2

You should also use the TransactionScope and DependentTransaction class for applications that require the use of the same transaction across multiple function calls or multiple thread calls. We recommend that you create implicit transactions using the TransactionScope class, so that the ambient transaction context is automatically managed for you. The System.Transactions infrastructure provides both an explicit programming model based on the Transaction class, as well as an implicit programming model using the TransactionScope class, in which transactions are automatically managed by the infrastructure. Writer.WriteLine("Rows to be affected by command1: ", ex.Message) ReturnValue = command1.ExecuteNonQuery() SqlCommand command1 = new SqlCommand(commandText1, connection1) Create the SqlCommand object and execute the first command.

alternative to netdrive 2

TransactionScope as a lightweight transaction. Opening the connection automatically enlists it in the Using (SqlConnection connection1 = new SqlConnection(connectString1)) Using (TransactionScope scope = new TransactionScope()) that both commands can commit or roll back as a single unit of work. Create the TransactionScope to execute the commands, guaranteeing System.IO.StringWriter writer = new System.IO.StringWriter() Initialize the return value to zero and create a StringWriter to display results. String commandText1, string commandText2) String connectString1, string connectString2,

alternative to netdrive 2

Static public int CreateTransactionScope( altering the code in the connection2 code block. on the same server by altering the connection string, or to another 3rd party RDBMS by To test this code, you can connect to two different databases It returns a value > 0 if the transaction is committed, 0 if the This function takes arguments for 2 connection strings and commands to create a transaction

Alternative to netdrive 2 how to#

The following example demonstrates how to use the TransactionScope class to define a block of code to participate in a transaction.








Alternative to netdrive 2