R
Rick.Qin
Unregistered / Unconfirmed
GUEST, unregistred user!
我这样写的WHILE的嵌套为啥第一层循环和第二层循环只执行一次啊??
String sql = "SELECT * FROM cdgl WHERE cdjb = 1";
ResultSet Rs = dbc.executeQuery(sql);
while (Rs.next()) {
out.print("<p>" + Rs.getInt("id") + ", " + Rs.getString("mlm") + "</p>");
String sql1 = "SELECT * FROM cdgl WHERE cdjb = 2";
ResultSet Rs1 = dbc.executeQuery(sql1);
while (Rs1.next()) {
out.print("<p>" + Rs1.getInt("id") + ", " + Rs1.getString("mlm") + "</p>");
/*
String sql2 = "SELECT * FROM cdgl WHERE cdjb = 3";
ResultSet Rs2 = dbc.executeQuery(sql2);
while (Rs2.next()) {
out.print("<p>" + Rs2.getInt("id") + ", " + Rs1.getString("mlm") + "</p>");
}
*/
}
}
String sql = "SELECT * FROM cdgl WHERE cdjb = 1";
ResultSet Rs = dbc.executeQuery(sql);
while (Rs.next()) {
out.print("<p>" + Rs.getInt("id") + ", " + Rs.getString("mlm") + "</p>");
String sql1 = "SELECT * FROM cdgl WHERE cdjb = 2";
ResultSet Rs1 = dbc.executeQuery(sql1);
while (Rs1.next()) {
out.print("<p>" + Rs1.getInt("id") + ", " + Rs1.getString("mlm") + "</p>");
/*
String sql2 = "SELECT * FROM cdgl WHERE cdjb = 3";
ResultSet Rs2 = dbc.executeQuery(sql2);
while (Rs2.next()) {
out.print("<p>" + Rs2.getInt("id") + ", " + Rs1.getString("mlm") + "</p>");
}
*/
}
}