i cannot update my form. it says that my sql is not properly ended. this is my updateCust of custDao. The ResultSet seem not be used. it seems to direct go to catch exception.
public void updateCust(Customer cust) {
try {
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("UPDATE CUSTOMER "
+ "SET custName = '" + cust.getCustName() + "',"
+ "custAdd = '" + cust.getCustAdd() + "',"
+ "custRegion = '" + cust.getCustRegion() + "' "
+ "custHandphoneNo = '" + cust.getCustHandphoneNo() + "' "
+ "custPhoneNo = '" + cust.getCustPhoneNo() + "' "
+ "custEmail = '" + cust.getCustEmail() + "' "
+ "WHERE cust_id = " + cust.getCust_id());
} catch (SQLException e) {
e.printStackTrace();
System.out.println("problem update");
}
}
this is my form after retrieve data from searchbox
<form action="CustomerController?action=edit" method="post">
<table>
<tr>
<td style:width="30px"><h3 class="templatemo-gold">ID Number: </h3></td>
<td style:width="70px">><input type="text" name="cust_id" id="cust_id" value="${custDetail.cust_id}"/> <br/><br/>
</td>
</tr>
<tr>
<td><h3 class="templatemo-gold">Name: </h3></td>
<td><input type="text" name="custName" id="custName" size="50" value="${custDetail.custName}"/> <br/><br/>
</td>
</tr>
<tr>
<td><h3 class="templatemo-gold">Address: </h3></td>
<td><input type="text" name="custAdd" size="50" value="${custDetail.custAdd}"
/><br/><br/></td>
</tr>
<tr>
<td><h3 class="templatemo-gold">Region: </h3></td>
<td><input type="text" name="custRegion" id="custRegion" size="50" value="${custDetail.custRegion}"
/><br/><br/></td>
</tr>
<tr>
<td>
<tr><h3 class="templatemo-gold">Handphone No: </h3></td>
<td><input type="text" name="custHandphoneNo" id="custHandphoneNo" size="50"
value="${custDetail.custHandphoneNo}"
/><br/><br/></td>
</tr>
<tr>
<td><h3 class="templatemo-gold">Phone No: </h3></td>
<td><input type="text" name="custPhoneNo" id="custPhoneNo" size="50" value="${custDetail.custPhoneNo}"
/><br/><br/></td>
</tr>
<tr>
<td><h3 class="templatemo-gold">Email: </h3></td>
<td><input type="text" name="custEmail" id="custEmail" size="50" value="${custDetail.custEmail}"
/><br/><br/></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Update" action="CustomerController?action=edit"
class="btn text-uppercase templatemo-btn templatemo-info-btn"></td>
<td><input type="submit" name="submit" value="Delete"
class="btn text-uppercase templatemo-btn templatemo-info-btn"></td>
</tr>
</table>
</form>
You are missing comma after end quote on these lines:
And please use PreparedStatement instead