示例#1
0
 // Редагувати ОВОЧ
 public static void updateVegetable(Vegetable x)
 {
     try
     {
         MySqlCommand command = new MySqlCommand("UPDATE fruitsvegetables.vegetables SET name = '" + x.getName() + "', price = '" + x.getPrice() + "', amount = '" + x.getAmount() + "', idStore = '" + x.getIdStore() + "' WHERE idVegetables = " + x.getIdVegetables() + ";", connect);
         command.ExecuteNonQuery();
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
 // Додати ОВОЧ
 public static void addVegetable(Vegetable x)
 {
     try
     {
         MySqlCommand command = new MySqlCommand("INSERT INTO fruitsvegetables.vegetables (`idVegetables`, `name`, `price`, `amount`, `idStore`) VALUES ( null, '" + x.getName() + "', '" + x.getPrice() + "', '" + x.getAmount() + "', '" + x.getIdStore() + "');", connect);
         command.ExecuteNonQuery();
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }