在线求助mysql 的删除代码
myeclipse吧
全部回复
仅看楼主
level 3
String sql =("delete from library where id="+"id");
这样写 居然把我所有的数据都给删除了
而我只需要删除
String id = request.getParameter("id");
一条id而已。。 菜鸟求教
2016年07月15日 08点07分 1
level 3
你要删除哪个id值就指定啊 id 指向所有的数据
2016年07月22日 06点07分 2
怎么指定一个参数?这句话不知道怎么写
2016年07月28日 05点07分
level 1
最后 id 是个参数而不是字符串
2016年07月24日 12点07分 3
那这句话要怎么写額?“delect from table where id”+id?这貌似也不行額
2016年07月28日 05点07分
level 9
先不说语病的问题,这么=号会有单独无效的()呢?上面的人已经给错了正确答案。
String sql = "delect from library where id = " + id;
2016年07月28日 07点07分 4
level 9
还有你传的id应该是整型吧?request得到这个值应该转换为整型的。
int id = Integer.parseint(request.getParameter("id");
2016年07月28日 07点07分 5
1