Example #1
0
 public void saveCustomer(Customer cus)
 {
     cmd.CommandText = "INSERT INTO customer(name, address, email, phone, birthday, point)" +
                 " values(@name, @address, @email, @phone, @birthday, @point)";
             cmd.Parameters.AddWithValue("@name", cus.getName());
             cmd.Parameters.AddWithValue("@address", cus.getAddress());
             cmd.Parameters.AddWithValue("@email", cus.getEmail());
             cmd.Parameters.AddWithValue("@phone", cus.getPhone());
             cmd.Parameters.AddWithValue("@birthday", cus.getBirthday());
             cmd.Parameters.AddWithValue("@point", cus.getPoint());
             cmd.ExecuteNonQuery();
             conn.Close();
 }
Example #2
0
 public void updateCustomer(Customer cus)
 {
     cmd.CommandText = " UPDATE customer SET name = @name, address=@address, "+
                       " email = @email, phone = @phone, birthday=@birthday "+
                       " where id = @id ";
     cmd.Parameters.AddWithValue("@name", cus.getName());
     cmd.Parameters.AddWithValue("@address", cus.getAddress());
     cmd.Parameters.AddWithValue("@email", cus.getEmail());
     cmd.Parameters.AddWithValue("@phone", cus.getPhone());
     cmd.Parameters.AddWithValue("@birthday", cus.getBirthday());
     cmd.Parameters.AddWithValue("@id", cus.getId());
     cmd.ExecuteNonQuery();
     conn.Close();
 }