public void Update(string oldPersonsFullName, Person person, string table) { string query = @"UPDATE " + table + " SET fullName='" + person.getFullName() + "', " + "address='" + person.getAddress() + "', " + "phone='" + person.getPhone() + "', " + "email='" + person.getEmail() + "'" + " WHERE fullName='" + oldPersonsFullName + "'"; if (this.OpenConnection() == true) { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = query; cmd.Connection = connection; cmd.ExecuteNonQuery(); this.CloseConnection(); } }
public void Insert(Person person, string table) { string query = @"INSERT INTO " + table + "(fullName, address, phone, email) VALUES ('" + person.getFullName() + "', '" + person.getAddress() + "', '" + person.getPhone() + "', '" + person.getEmail() + "')"; if (this.OpenConnection() == true) { MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); this.CloseConnection(); } }