private void delete_Click(object sender, EventArgs e) { MSAConnection.execute("delete from contact where id=" + id); MessageBox.Show("Eliminado Exitosamente!!"); Form1.load(); Dispose(); }
public static void load() { ContactForm.data.Rows.Clear(); OleDbDataReader r = MSAConnection.read("select * from contact"); while (r.Read()) { ContactForm.data.Rows.Add(r.GetInt32(0), r.GetString(1), r.GetString(2), r.GetString(3), r.GetString(4)); } }
private void ok_Click(object sender, EventArgs e) { if (firstname.Text != "") { if (action == "add") { MSAConnection.execute("insert into contact (firstname,lastname,address,email,phone) values (\"" + firstname.Text + "\",\"" + lastname.Text + "\",\"" + address.Text + "\",\"" + email.Text + "\",\"" + phone.Text + "\")"); firstname.Text = lastname.Text = address.Text = phone.Text = email.Text = ""; MessageBox.Show("Agregado Exitosamente!!"); } else if (action == "update") { MSAConnection.execute("update contact set firstname=\"" + firstname.Text + "\",lastname=\"" + lastname.Text + "\",address=\"" + address.Text + "\",email=\"" + email.Text + "\",phone=\"" + phone.Text + "\" where id=" + id); //firstname.Text = lastname.Text = address.Text = phone.Text = email.Text = ""; MessageBox.Show("Actualizado Exitosamente!!"); } } else { MessageBox.Show("Campos Obligatorio: Nombre"); } }
public ContactForm() { InitializeComponent(); if (action == "update") { OleDbDataReader r = MSAConnection.read("select * from contact where id=" + id); while (r.Read()) { firstname.Text = r.GetString(1); lastname.Text = r.GetString(2); address.Text = r.GetString(3); email.Text = r.GetString(5); phone.Text = r.GetString(4); break; } } else if (action == "add") { delete.Enabled = false; } }