private void btnAddPub_Click(object sender, EventArgs e) { string id = txtPublisherID.Text; string name = txtPublisherName.Text; string address = txtPublisherAddress.Text; string email = txtPublisherEmail.Text; string phone = txtPublisherPhone.Text; try { if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(address) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(phone)) { MessageBox.Show("Don't leave the blank box!"); } else { publisherdao.addPublisher(id, name, address, email, phone); LoadPublisher(); MessageBox.Show("Create successfully!"); } } catch (Exception exc) { if (exc.Message.Contains("duplicate")) { MessageBox.Show("Publisher is existed!"); } } }