From e798dc159f810f6354344d28d90fec1746aa6139 Mon Sep 17 00:00:00 2001 From: jeff-cycode <163135025+jeff-cycode@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:28:08 -0500 Subject: [PATCH] Create zebra.cs --- zebra.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 zebra.cs 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; + } +