private void InsertDatabase() { try { string query = "INSERT INTO MsEmployee VALUES ('" + txtID.Text + "','" + txtName.Text + "','" + txtEmail.Text + "','" + txtPass.Text + "','" + cbxRole.Text + "')"; con.ExecuteUpdate(query); } catch (Exception ex) { MessageBox.Show(null, ex.ToString(), "An exception occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void InsertDatabase() { try { string query = "INSERT INTO MsBook VALUES ('" + txtBookID.Text + "','" + txtBookTitle.Text + "','" + cbxBookTypeID.Text + "'," + txtPrice.Text + "," + numTotalPage.Value.ToString() + ",'" + txtAuthor.Text + "','" + txtPublisher.Text + "','" + txtISBN.Text + "'," + numStock.Value.ToString() + ")"; con.ExecuteUpdate(query); } catch (Exception ex) { MessageBox.Show(null, ex.ToString(), "An exception occured", MessageBoxButtons.OK, MessageBoxIcon.Error); } }