diff --git a/zebra.cs b/zebra.cs new file mode 100644 index 0000000..a28c8ac --- /dev/null +++ b/zebra.cs @@ -0,0 +1,26 @@ + public static int ExecuteNonQueryStoredProcedure(SqlConnection connection, string storedProcedureName, SqlParameter[] parameters, ExternalTransaction externalTransaction = null, int? timeout = null) + { + var retval = -1; + + using (var sqlCommand = new SqlCommand(storedProcedureName, connection)) + { + + if (externalTransaction != null) + { + sqlCommand.Transaction = externalTransaction.Transaction; + } + + if (timeout.HasValue) + { + sqlCommand.CommandTimeout = timeout.Value; + } + + sqlCommand.CommandType = CommandType.StoredProcedure; + sqlCommand.Parameters.AddRange(parameters); + + retval = sqlCommand.ExecuteNonQuery(); + } + + return retval; + } +