Пример #1
0
 public Boolean updateCustomer(EntCustomer ec, int id_customer)
 {
     status = false;
     try
     {
         koneksi.Open();
         query = "UPDATE customer SET nama_customer ='" + ec.getNamaCustomer() + "', alamat ='" + ec.getAlamat() + "', email ='" + ec.getEmail() + "', no_hp ='" + ec.getHP() + "' WHERE id_customer=" + id_customer + "";
         MySqlCommand command = koneksi.CreateCommand();
         command.CommandText = query;
         command.ExecuteNonQuery();
         status = true;
         koneksi.Close();
     }
     catch (MySqlException me)
     {
         Console.WriteLine(me);
     }
     return(status);
 }
Пример #2
0
 public Boolean insertCustomer(EntCustomer ec)
 {
     status = false;
     try
     {
         koneksi.Open();
         query = "INSERT INTO customer (nama_customer,alamat,email,no_hp) VALUES ('" + ec.getNamaCustomer() + "' , '" + ec.getAlamat() + "', '" + ec.getEmail() + "', '" + ec.getHP() + "')";
         MySqlCommand command = koneksi.CreateCommand();
         command.CommandText = query;
         command.ExecuteNonQuery();
         status = true;
         koneksi.Close();
     }
     catch (MySqlException me)
     {
         Console.WriteLine(me);
     }
     return(status);
 }