Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions zebra.cs
Original file line number Diff line number Diff line change
@@ -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;
}