I use MS-Access Database using C# for my Windows Forms Application
I have the Following two combo boxes 1 combo box with EEID-Unique ID and Employee name I have a 2nd Combo box with a list of employee statuses example: Current Employee, Other, Terminated. I want to update the status of the employee by the value selected in combobox2. I have the following in Code and I dont get any errors, it doesn't update the employees status?
I have tried both of the following an neither work
using (OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\srye\Desktop\MSaccess\Employee Database - Copy2.accdb"))
{
con.Open();
OleDbCommand cmd = new OleDbCommand(@"UPDATE tblExsitingEEs SET tblExsitingEEs.Status= ? where (tblExsitingEEs.eeid= ?)", con);
cmd.Parameters.Add("@Status", OleDbType.VarChar).Value = cmbStatus.SelectedValue.ToString();
cmd.Parameters.Add("@eeid", OleDbType.VarChar).Value = cmbEmployee.SelectedValue.ToString();
cmd.ExecuteNonQuery();
con.Close();
}
using (OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\srye\Desktop\MSaccess\Employee Database - Copy2.accdb"))
{
con.Open();
OleDbCommand cmd = new OleDbCommand(@"UPDATE tblExsitingEEs SET tblExsitingEEs.Status= ? where (tblExsitingEEs.eeid= ?)", con);
cmd.Parameters.Add("@eeid", OleDbType.VarChar).Value = cmbEmployee.SelectedValue.ToString();
cmd.Parameters.Add("@Status", OleDbType.VarChar).Value = cmbStatus.SelectedValue.ToString();
cmd.ExecuteNonQuery();
con.Close();
}
shawnrye