String sql="update dishes set foodName = ? , foodPrice=? ,
foodWeight=? ,cost_performance=? , address=? ,date=? , firstCategoty=?,
secondCategory=? , foods=? , photo=? , other =? where id=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stu.getFoodname());
pstmt.setFloat(2, stu.getPrice());
pstmt.setFloat(3, stu.getWeight());
pstmt.setInt(4, stu.getCost_performance());
pstmt.setString(5, stu.getAddress());
pstmt.setString(6, stu.getDate());
pstmt.setString(7, stu.getFirstCategory());
pstmt.setString(8, stu.getSecondCategory());
pstmt.setString(9, stu.getFoods());
pstmt.setString(10, stu.getPhoto());
pstmt.setString(11, stu.getOther());
pstmt.executeUpdate();
应该加上
pstmt.setInt(12, stu.getId());
即
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, stu.getFoodname());
pstmt.setFloat(2, stu.getPrice());
pstmt.setFloat(3, stu.getWeight());
pstmt.setInt(4, stu.getCost_performance());
pstmt.setString(5, stu.getAddress());
pstmt.setString(6, stu.getDate());
pstmt.setString(7, stu.getFirstCategory());
pstmt.setString(8, stu.getSecondCategory());
pstmt.setString(9, stu.getFoods());
pstmt.setString(10, stu.getPhoto());
pstmt.setString(11, stu.getOther());
pstmt.setInt(12, stu.getId());
pstmt.executeUpdate();
第12个?没有赋值,也就是id没有指定