主题:jsp中while(re.next())进不去循环
我建的表如下:
CREATE TABLE stu(
stuID varchar2(8) PRIMARY KEY NOT NULL,
stuName varchar2(10) NOT NULL,
stuPassword varchar2(15) NOT NULL,
stuZhuanye varchar2(12),
stuSex varchar2(1) CHECK(stuSex IN('1','0')),
stuRemarks varchar2(50)
);
插入的数据:
insert into stu values('04083303','哈哈,'04083303','软件工程','1','好学生');
insert into stu values('04083304','阿顿','04083304','软件工程','1','好学生');
我的程序如下:
......
try{
String url="jdbc:oracle:thin:@"+server+":1521:CONG";
conn=DriverManager.getConnection(url,"system","system");
stmt=conn.createStatement();
rs = stmt.executeQuery("select stuID, stuPassword from stu");
out.println(rs.next());
while(rs.next())
{
ID = rs.getString("stuID");
password = rs.getString("stuPassword");
if(ID.equals(strUserID) && password.equals(strUserPWD))
{
out.println(ID+" "+"欢迎您的光临!"+right1);
session.setAttribute("TTT",ID);
return;
}
}
}catch(SQLException e){
out.println(e.getMessage());
}
......
经过测试,发现while(rs.next())这个循环始终进不去,请问高手们帮我解决一下!
万分感谢!
CREATE TABLE stu(
stuID varchar2(8) PRIMARY KEY NOT NULL,
stuName varchar2(10) NOT NULL,
stuPassword varchar2(15) NOT NULL,
stuZhuanye varchar2(12),
stuSex varchar2(1) CHECK(stuSex IN('1','0')),
stuRemarks varchar2(50)
);
插入的数据:
insert into stu values('04083303','哈哈,'04083303','软件工程','1','好学生');
insert into stu values('04083304','阿顿','04083304','软件工程','1','好学生');
我的程序如下:
......
try{
String url="jdbc:oracle:thin:@"+server+":1521:CONG";
conn=DriverManager.getConnection(url,"system","system");
stmt=conn.createStatement();
rs = stmt.executeQuery("select stuID, stuPassword from stu");
out.println(rs.next());
while(rs.next())
{
ID = rs.getString("stuID");
password = rs.getString("stuPassword");
if(ID.equals(strUserID) && password.equals(strUserPWD))
{
out.println(ID+" "+"欢迎您的光临!"+right1);
session.setAttribute("TTT",ID);
return;
}
}
}catch(SQLException e){
out.println(e.getMessage());
}
......
经过测试,发现while(rs.next())这个循环始终进不去,请问高手们帮我解决一下!
万分感谢!