public static int ExecuteNonQuery(MySqlConnection connection, string procedure, ListDictionary parameterValues) { bool flag = false; try { if (connection == null) { throw new ArgumentException("Valid connection is required."); } if (procedure == null || procedure == "") { throw new ArgumentException("Valid procedure is required."); } MySqlCommand sqlCommand = ServerCommon.GetMySqlCommand(connection.ConnectionString, procedure); sqlCommand.Connection = connection; ServerCommon.SetParameterValues(sqlCommand, parameterValues); if (connection.State == ConnectionState.Closed) { flag = true; connection.Open(); } int num = sqlCommand.ExecuteNonQuery(); ServerCommon.GetParameterValues(sqlCommand, parameterValues); return(num); } catch (Exception ex) { throw ex; } finally { if (flag) { connection.Close(); } } }