나는 메시지를 받고있다
"MySQLSyntaxErrorExcetpion You have an error in your SQL syntax."
나는 온라인 튜토리얼을 따르고 있는데 내 코드와 내가 따르는 코드에서 무엇이 다른지 알 수 없습니다. 누구든지 내가 어디에서 잘못되었는지 지적 할 수 있습니까?
추가 정보가 필요한 경우 알려주십시오.
btn_update.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try{
theQuery("update users set fname = '" + firstNameField.getText() + "', lname = '" + lastNameField.getText() +"', age=" + ageField.getText() + "where id = " + idField.getText());
}
catch(Exception ex)
{
System.out.println(ex);
}
}
});
여기에 공백이 없기 때문입니다.
age=" + ageField.getText() + "where id = " + idField.getText());
당신은 그것을 변경해야합니다
age= " + ageField.getText() + " where id = " + idField.getText());
기본 방식 대신 PreparedStatement 를 사용하는 것이 좋습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다