| String sql1=”select * from user where userName=”””+userName+””””; | |
| 3分 #1 | 
把最后生成的sql语句在数据库里执行下看看 | 
| #2 | 
try{ Connection con=null; Statement stmt=null; ResultSet rs=null; Class.forName(“com.mysql.jdbc.Driver”); String url=”jdbc:mysql://localhost:3306/person?useUnicode=true&characterEncoding=gbk”; con=DriverManager.getConnection(url,”root”,”123456″); stmt=con.createStatement(); String sql1=”select * from user where userName=”””+userName+””””; rs=stmt.executeQuery(sql1); rs.last(); int k; k=rs.getRow(); if(k>0){ wrong3(); response.sendRedirect(“http://localhost:8080/PIMS/login.jsp”); }else{ String sql2=”insert into user” +”(userName,password,name,sex,birth,nation,edu,work,phone,place,email)”+”values(” +””””+userName+””””+”,”+””””+password1+””””+”,”+””””+name+””””+”,”+””””+sex+””””+”,”+””””+birth+””””+”,” +””””+nation+””””+”,”+””””+edu+””””+”,”+””””+work+””””+”,”+””””+phone+””””+”,”+””””+place+””””+”,”+””””+email+””””+”)”; stmt.executeUpdate(sql2); } rs.close(); stmt.close(); con.close(); right(); response.sendRedirect(“http://http://localhost:8080/PIMS/login.jsp”); }catch(Exception e){ e.printStackTrace(); } | 
| 3分 #3 | 
有 userName  列 吗 | 
| #4 |  这个肯定有啊 | 
| 6分 #5 | |
| #6 | 
Unknown column “”username”” in “”where clause”” 楼上小哥,我全改了,结果。并没有什么。 | 
| 8分 #7 | 
String sql1=”select * from user where userName=”””+userName+””””; 该为String sql1=”select * from user where userName=”+userName; | 
| #8 | 
String sql1=”select * from user where userName=”””+userName+””””; 改为String sql1=”select * from user where userName=”+””””+userName””””; | 
| #9 | 
经过两天的检查,终于在页面的框架里面找到了数据库insert的一段代码错误,结贴了,谢谢各位高手 | 
 
                    


