以下のコードを使用して Access データベースのデータを更新または編集しますが、ボタンをクリックするたびにこのエラーが表示されます。
net.ucanaccess.jdbc.UcanaccessSQLException:予期しないステートメントの終わり
public void actionPerformed(ActionEvent e)
{
String employeeName = endrollNameFields.getText();
String employeeAddress = endrollAddressFields.getText();
String employeeStatus = endrollEmploymentStatusFields.getText();
String employeeDateOfMembership = dateOfMembershipFields.getText();
String employeeAge = ageFields.getText();
String employeMStatus = statusFields.getText();
String employeeBloodType = bloodTypeFields.getText();
String employeeDateBirth = birthDateFields.getText();
String employeeGender = genderFields.getText();
String beginningCapital = beginningCapitalFields.getText();
String grossSalary = grossSalaryFields.getText();
String salaryDeductions = salaryDeductionFields.getText();
String netSalary = netSalaryFields.getText();
try
{
//------------CREATE CONNECTION TO DATA BASE--------------/
String DBPAD = "sourceFolder/employeeTable2.mdb";
String DB = "jdbc:ucanaccess://" + DBPAD;
con = DriverManager.getConnection(DB);
st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql = "Select * employeeTable2";
rs = st.executeQuery(sql);
if (rs != null)
while ( rs.next())
{
rs.updateString("Employee Name", employeeName);
rs.updateString("Employee Address", employeeAddress);
rs.updateString("Employee Status", employeeStatus);
rs.updateString("Employee Date of Membership", employeeDateOfMembership);
rs.updateString("Employee Age", employeeAge);
rs.updateString("Employee Marital Status", employeMStatus);
rs.updateString("Employee Blood Type", employeeBloodType);
rs.updateString("Employee Date Birth", employeeDateBirth);
rs.updateString("Employee Gender", employeeGender);
rs.updateString("Beginning Capital", beginningCapital);
rs.updateString("Gross Salary", grossSalary);
rs.updateString("Salary Deductions", salaryDeductions);
rs.updateString("Net Salary", netSalary);
rs.updateRow();
}
st.close();
con.close();
st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql1 = "select * from employeeTable2";
rs = st.executeQuery(sql1);
JOptionPane.showMessageDialog(null, "<html>" + "<font color=\"#008000\">" + "<html><span style='font-size:1.5em'>Update to Data Base is Successful");
endrollNameFields.setText(" ");
endrollAddressFields.setText(" ");
endrollEmploymentStatusFields.setText(" ");
dateOfMembershipFields.setText(" ");
ageFields.setText(" ");
statusFields.setText(" ");
bloodTypeFields.setText(" ");
birthDateFields.setText(" ");
genderFields.setText(" ");
beginningCapitalFields.setText(" ");;
grossSalaryFields.setText(" ");
salaryDeductionFields.setText(" ");
netSalaryFields.setText(" ");
editFrame.dispose();
}
catch(Exception e1)
{
JOptionPane.showMessageDialog(null, e1);
}
}
});