This is what i'm trying to acheive. Each result which appears in the table will have a delte link. When i click on it i need it to delete that particular record from the database. I get the following error. What might be wrong. Thank you for your help.
javax.servlet.ServletException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1
<%
while (rst2.next()){ %>
<tr>
<td rowspan="2" align=center bgcolor="#FFFFFF"><%= rst2.getString("Status") %></td>
<td rowspan="2" align=center bgcolor="#FFFFFF"><%= rst2.getString("Leave_Type") %></td>
<td rowspan="2" align=center bgcolor="#FFFFFF"><%= rst2.getString("Date_From") %></td>
<td rowspan="2" align=center bgcolor="#FFFFFF"><%= rst2.getString("Date_to") %></td>
<td rowspan="2" align=center bgcolor="#FFFFFF"><%= rst2.getString("Duration") %></td>
<td rowspan="2" align=center bgcolor="#FFFFFF"><a href="Deleterecord.jsp"?datedel=<%= rst2.getString("Date_From") %>>Delete</a></td>
</tr>
<tr> </tr>
<%}
%>
String query = "DELETE FROM tb_leavemc where Date_From =?";
java.sql.PreparedStatement statement = con.prepareStatement(query);
statement.setString(1,(request.getParameter("datedel")));
stm.executeUpdate(query);