try
            {
                OleDbCommand cmd = new OleDbCommand(String.Concat("UPDATE EMPLOYEE SET",
                " Emp_Name='", rec.txtEmpName, "',E_Position='", rec.txtPosition,
                "', Department='", rec.txtDepartment, "',Date_Hired='", rec.txtHired, 
                "', Address_City='",rec.txtAdC, "',Address_Province='", rec.txtAdP, 
                "', Civil_Status='", rec.txtCivil, "',Maiden_Name='", rec.txtMaiden,
                "', Spouse_Name='", rec.txtSpouse, "',Citizenship='",rec.txtCitizen, 
                "', Telephone='", rec.txtPhone, "',Mobile_Phone='", rec.txtMobile, 
                "', Emergency='", rec.txtEmergency, "',Birthdate='", rec.txtDOB, 
                "', Birth_Place='",rec.txtBirthPlace, "',Height='", rec.txtHeight, 
                "', Weight='", rec.txtWeight, "',Religion='", rec.txtReligion, 
                "', Blood_Type='", rec.txtBlood, "',SSS_No='",rec.txtSSS, 
                "', TIN_No='", rec.txtTIN, "',PAG_IBIG_No='", rec.txtPagibig,
                " WHERE Emp_ID=",rec.Emp_ID), clsData.con);
                clsData.con.Close();
                clsData.con.Open();
                cmd.ExecuteNonQuery();
                cmd.Dispose();
                clsData.con.Close();
            }

for some reason it outputs an error

syntax error in WHERE Emp_ID = 'value.

Recommended Answers

All 2 Replies

Maybe you need to close the preceding apostrophe before the WHERE clause like:

"', TIN_No='", rec.txtTIN, "',PAG_IBIG_No='", rec.txtPagibig,
                "' WHERE Emp_ID=",rec.Emp_ID), clsData.con);

Hope this helps

This way:

" WHERE Emp_ID= '",rec.Emp_ID, "'"), clsData.con);

One more thing, you can write pluses "+" instead of commas ",", like:

" WHERE Emp_ID= '" + rec.Emp_ID + "'"), clsData.con);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.