public int DeleteOrderDuck(OrderDuck od) { try { comm.CommandText = "DELETE FROM OrderDuck WHERE id_order=@id_order AND id_duck=@id_duck"; comm.Parameters.AddWithValue("id_order", od.id_order); comm.Parameters.AddWithValue("id_duck", od.id_duck); comm.CommandType = CommandType.Text; connect.Open(); return(comm.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (connect != null) { connect.Close(); } } }
public int InsertOrderDuck(OrderDuck od) { try { comm.CommandText = "INSERT INTO OrderDuck VALUES(@id_order, @id_duck)"; comm.Parameters.AddWithValue("id_order", od.id_order); comm.Parameters.AddWithValue("id_duck", od.id_duck); comm.CommandType = CommandType.Text; connect.Open(); return(comm.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (connect != null) { connect.Close(); } } }