时间:2021-07-01 10:21:17 帮助过:29人阅读
public void insert(HttpServletRequest request, HttpServletResponse response) throws SQLException, ClassNotFoundException { Connection conn = connection(); Statement sta = conn.createStatement(); String name = request.getParameter("name"); String id = request.getParameter("id"); String password = request.getParameter("password"); String age = request.getParameter("age"); String company = request.getParameter("company"); System.out.println(name + id + password +age +company); sta.execute ("insert into user.manage (name,id,password,age,company) values("+name+","+id+","+password+","+age+","+company+")"); // 蓝色的都是以文本的形式传递,黑色的则是以值的形式传递 close(sta, conn); }
Insert title here
试试
String SQL="insert into user.manage (name,id,password,age,company) values('"+name+"','"+id+"','"+password+"','"+age+"','"+company+"')";sta.executeUpdate(SQL);
试试
String SQL="insert into user.manage (name,id,password,age,company) values('"+name+"','"+id+"','"+password+"','"+age+"','"+company+"')";sta.executeUpdate(SQL);还是不行,不知道哪里出错了
对应user.manage表的列类型,改一改values中的值。是数字的可以不用单引号
试试
String SQL="insert into user.manage (name,id,password,age,company) values('"+name+"','"+id+"','"+password+"','"+age+"','"+company+"')";sta.executeUpdate(SQL);还是不行,不知道哪里出错了
试试
String SQL="insert into user.manage (name,id,password,age,company) values('"+name+"','"+id+"','"+password+"','"+age+"','"+company+"')";sta.executeUpdate(SQL);还是不行,不知道哪里出错了