protected void updateVendor(TextBox[] vendors, String id, addVendor ven) { try { conn = new MySqlConnection(this.connection()); conn.Open(); using (command = new MySqlCommand("UPDATE vendor SET vendor = @vendor, address = @address, contactPerson = @contactperson, telephoneNo = @telephone, email = @mail, fax = @fax WHERE vendor_id = @id", conn)) { command.Parameters.AddWithValue("@vendor", vendors[0].Text); command.Parameters.AddWithValue("@address", vendors[1].Text); command.Parameters.AddWithValue("@contactperson", vendors[2].Text); command.Parameters.AddWithValue("@telephone", vendors[3].Text); command.Parameters.AddWithValue("@mail", vendors[4].Text); command.Parameters.AddWithValue("@fax", vendors[5].Text); command.Parameters.AddWithValue("@id", id); bool checkResult = (int)command.ExecuteNonQuery() > 0; if (checkResult == true) { MessageBox.Show("Successfully Save", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } foreach (TextBox vendor in vendors) { vendor.Clear(); } ven.Hide(); } conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void updVendor(TextBox[] vendor, String id, addVendor suspend) { this.updateVendor(vendor, id, suspend); }