private void BtnUpdate_Click(object sender, EventArgs e) { if (TxbCID.Text != "" && TxbCID.Text != null) { sql = "update tbcategory set category='" + TxbCategory.Text + "' where cid=" + TxbCID.Text; if (DBClass.Run_SQL(sql) > 0) { CleanControls(); BindDgvCate(); MessageBox.Show("record has been updated!"); } else { MessageBox.Show("failed!"); } } else { MessageBox.Show("select record first!"); return; } }
private void BtnFUpdate_Click(object sender, EventArgs e) { if (TxbFID.Text != "" && TxbFID.Text != null) { sql = "update tbfile set filename='" + TxbFName.Text + "',filepath='" + TxbFPath.Text + "' where fid=" + TxbFID.Text; if (DBClass.Run_SQL(sql) > 0) { CleanControls(); BindDgvFile(); MessageBox.Show("record has been updated!"); } else { MessageBox.Show("failed!"); } } else { MessageBox.Show("select record first!"); return; } }
private void BtnDelete_Click(object sender, EventArgs e) { if (TxbCID.Text != "" && TxbCID.Text != null) { if (MessageBox.Show("delete double check", "info", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { sql = "delete from tbcategory where cid=" + TxbCID.Text; if (DBClass.Run_SQL(sql) > 0) { CleanControls(); BindDgvCate(); MessageBox.Show("record has been deleted!"); } else { MessageBox.Show("failed!"); } } } else { MessageBox.Show("select record first!"); } }