1
ユーザ入力データをデータベースに挿入しようとしていますが、「構文エラー:遭遇しました」というエラーが表示されています。ここに私のコードは、私が間違って何をやっている、ある? `挿入したSQL文のエラー
if (action.getSource() == Submit_button)
{
try
{
sql = "INSERT INTO Customer (FNAME, LNAME, AGE, LICNUM, STATE, CAR_TYPE, RENTDATE, RETURNDATE, TOTAL, PAYTYPE, RETURNED) VALUES(";
sql = sql + "'" + f_name.getText() + "'" + "," + "'" + l_name.getText() + "'" + "," + Age + "," + "'" + liscense_num.getText() + "'" + "," + "'"
+ issuing.getText() + "'" + "," + "'" + car_select.getToolkit() + "'" + "," + "'" + rental.getText() + "'" + "," + "'" + return_d.getText() + "'"
+ "," + total.getText() + "," + "'" + button_val.getText() + "'" + "," + "'true'" + ")";
myStatement.execute(sql);
System.out.print("Record has Been added to database");
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
post the stack trace – Priyamal