Berikut kodingnya :
void editData()
{
initConnection();
try
{
Statement st = (Statement) config.getConnection().createStatement();
int mAffect = st.executeUpdate("UPDATE `db_me`.`admin` SET "
+ "`usercode` = '"+txt_kode_user.getText()+"', "
+ "`username` = '"+txt_user_name.getText()+"', "
+ "`password` = '"+txt_user_pass.getText()+"', "
+ "`bagian` = '"+cbo_bagian.getSelectedItem()+"' "
+ "WHERE CONVERT(`admin`.`kode_user` USING utf8) = '"+txt_kode_user.getText()+"' LIMIT 1;");
if (mAffect>0) {
System.out.println("Sukses");
}
st.close();
}
catch (SQLException ex)
{
System.out.println(ex);
}
}
Post a Comment