我在这里错过了什么愚蠢的东西吗?
String update = "UPDATE Patients SET fullName = '" + patient.getName() + "',
houseNum = '" + patient.getHouseNum() + "',
address = '" + patient.getAddress() +"',
postCode = '" + patient.getPostCode() + "',
condition = '" + patient.getCondition() + "',
who = '" + patient.getWho() + "',
time = '" + patient.getTime() + "',
location = '" + patient.getLocation() + "',
actionTaken = '" + patient.getActionTaken() + "',
duration = '" + patient.getDuration() + "'
WHERE regNo = '" +patient.getNHSnum()+"'";
为此,我在每一行都返回以进行格式化。在我的文件中,它位于一行。所有数据库字段都是文本类型。
我得到的错误是:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. -3503
编辑:
有关信息,以下工作正常:
String update = "UPDATE Patients SET fullName = '" + patient.getName() + "',
houseNum = '" + patient.getHouseNum() + "',
address = '" + patient.getAddress() +"',
postCode = '" + patient.getPostCode() + "',
condition = '" + patient.getCondition() + "'
WHERE regNo = '" +patient.getNHSnum()+"'";
编辑2:
这是完整的更新字符串:
UPDATE Patients SET fullName = 'Dave', houseNum = '5', address = 'Bla', postCode = 'PQ1 RS2', condition = 'Unknown', who = 'Test', time = 'Test1', location = 'Test2', actionTaken = 'Test3', duration = 'Test4' WHERE regNo = '1'
正如我所说,在这个例子中,数据库中的每个字段都是文本类型