private int GetServerTransactionLevel() { using (SqlCommand command = new SqlCommand("set @out = @@trancount", (SqlConnection)this._innerConnection.Owner)) { command.Transaction = this.Parent; SqlParameter parameter = new SqlParameter("@out", SqlDbType.Int) { Direction = ParameterDirection.Output }; command.Parameters.Add(parameter); command.RunExecuteReader(CommandBehavior.Default, RunBehavior.UntilDone, false, "GetServerTransactionLevel"); return((int)parameter.Value); } }
private int GetServerTransactionLevel() { // This function is needed for those times when it is impossible to determine the server's // transaction level, unless the user's arguments were parsed - which is something we don't want // to do. An example when it is impossible to determine the level is after a rollback. using (SqlCommand transactionLevelCommand = new SqlCommand("set @out = @@trancount", (SqlConnection)(_innerConnection.Owner))) { transactionLevelCommand.Transaction = Parent; SqlParameter parameter = new SqlParameter("@out", SqlDbType.Int); parameter.Direction = ParameterDirection.Output; transactionLevelCommand.Parameters.Add(parameter); transactionLevelCommand.RunExecuteReader(CommandBehavior.Default, RunBehavior.UntilDone, returnStream: false); return((int)parameter.Value); } }
private int GetServerTransactionLevel() { // This function is needed for those times when it is impossible to determine the server's // transaction level, unless the user's arguments were parsed - which is something we don't want // to do. An example when it is impossible to determine the level is after a rollback. using (SqlCommand transactionLevelCommand = new SqlCommand("set @out = @@trancount", (SqlConnection)(_innerConnection.Owner))) { transactionLevelCommand.Transaction = Parent; SqlParameter parameter = new SqlParameter("@out", SqlDbType.Int); parameter.Direction = ParameterDirection.Output; transactionLevelCommand.Parameters.Add(parameter); transactionLevelCommand.RunExecuteReader(CommandBehavior.Default, RunBehavior.UntilDone, returnStream: false); return (int)parameter.Value; } }
private int GetServerTransactionLevel() { using (SqlCommand command = new SqlCommand("set @out = @@trancount", (SqlConnection) this._innerConnection.Owner)) { command.Transaction = this.Parent; SqlParameter parameter = new SqlParameter("@out", SqlDbType.Int) { Direction = ParameterDirection.Output }; command.Parameters.Add(parameter); command.RunExecuteReader(CommandBehavior.Default, RunBehavior.UntilDone, false, "GetServerTransactionLevel"); return (int) parameter.Value; } }