0
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.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
0

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

0

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);

Edited by Mitja Bonca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.