我的数据库由两列用户名和余额组成。username 的值为 Mike,balance 的值为 null。我正在尝试更新余额,但由于某种原因它没有更新。我也没有收到任何错误。有什么建议么
<p>This is the deposit page</p>
<form action="deposit.jsp" method="POST">
<label>deposit: </label><input type="text" name="deposit"><br>
<label>name: </label><input type="text" name="name"><br>
<input type="submit" value="deposit">
<%
String deposit=request.getParameter("deposit");
String name=request.getParameter("name");
try{
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
Statement st=null;
st=conn.createStatement();
st.executeUpdate("update username set balance='"+deposit+"' where username='"+name+"'");
}
catch(Exception e){
System.out.println(e);
}
%>
</form>
</body>
</html>