我收到“列计数与第 1 行的值计数不匹配”,但我似乎无法修复它。我尝试更改引号和数据类型,但仍然没有运气。谁能看到我哪里出错了?
public void actionPerformed(ActionEvent arg0) {
if(!textField.getText().isEmpty() && !textField_1.getText().isEmpty() && !textField_2.getText().isEmpty() && !textField_3.getText().isEmpty() && !textField_4.getText().isEmpty() && !textField_5.getText().isEmpty() && !textField_6.getText().isEmpty() && !textField_7.getText().isEmpty())
{
String moduleName = textField.getText();
String studId = textField_1.getText();
String sFName = textField_2.getText();
String sLName = textField_3.getText();
int weekNo = Integer.parseInt(textField_4.getText());
int lAttend = Integer.parseInt(textField_5.getText());
int tAttend = Integer.parseInt(textField_6.getText());
int wAttend = Integer.parseInt(textField_7.getText());
lh.addStud(moduleName, studId, sFName, sLName , weekNo, lAttend, tAttend, wAttend);
}
else
{
lblNewLabel_4.setText("You have Missing Field");
}
fillDB();
}
});
以下是我的查询:
String aSQuery = "INSERT INTO Group6_Register VALUES ('" + moduleName + "', '" + studId + "', '" + sFName + "', '" + sLName +"', '" + weekNo + "', '" + lAttend + "', '" + tAttend + "', '" + wAttend + "')";
statements = connection.prepareStatement(aSQuery);
statements.executeUpdate();