Hi guys,
I have 2 boxes (UsernameComboBox and PasswordTextBox) and 1 button (UpdateButton) and i would like it to update based on the info inserted above. Can someone shed some light on what's wrong with my codes below?
private void UpdateButton_Click(object sender, EventArgs e)
{
PC001 f1 = new PC001();
Username = UsernameComboBox.Text.ToString();
Password = PasswordTextBox.Text.ToString();
string SQLUpdateString;
SQLUpdateString = "UPDATE PC SET PCUsername ='" + Username + "', PCPassword='" + Password + "' WHERE PCName='PC001'";
OleDbCommand SQLCommand = new OleDbCommand();
SQLCommand.CommandText = SQLUpdateString;
SQLCommand.Connection = f1.DBconn;
int response = SQLCommand.ExecuteNonQuery();
MessageBox.Show("Update successful!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}