作者qrtt1 (愚人)
站内java
标题Re: [JSP ] SQL与rs.getString的问题
时间Mon Nov 12 21:07:43 2007
: if(rs1.next()){
: while(rs1.next()){
: String SQL2 = "SELECT "+session.getAttribute("Role")+" FROM lvl
: WHERE 功能 = '"+rs1.getString(2)+"'";
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html#next()
Moves the cursor down one row from its current position. A ResultSet
cursor is initially positioned before the first row; the first call to the
method next makes the first row the current row; the second call makes the
second row the current row, and so on.
你多 move 了
还有您的痛苦来自於用了难用的方法
用 Prepared Statement 会轻松且安全一点
http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.167.103.78
1F:推 PsMonkey:这未必是错误来源啊啊啊... 11/12 21:48
2F:推 qrtt1:先改成容易成功的方法, 会让自己的人蔘不会那麽苦涩 11/12 22:32