查看: 856|回复: 2
|
JAVA ---> RESULTSET IS CLOSED....................
[复制链接]
|
|
为什么回这样?
各位JAVA高手请教教小弟我。。。。
public String word_classifier(String word)
{
String newTag = "++";
ResultSet result;
ResultSet result2;
ResultSet result3;
Statement query;
try {
query = conn.createStatement();
result = query.executeQuery("select Word_ID from tblWord where Word_Name = '"+word+"'");
while(result.next()) {
int WID = result.getInt("Word_ID");
System.out.println(WID);
try{
result2 = query.executeQuery("select Tag_ID from tblWordTag where Word_ID = "+WID+"");
while(result2.next()) {
int TID = result2.getInt("Tag_ID");
System.out.println(TID);
try{
result3 = query.executeQuery("select Tag_Name from tblTagSet where Tag_ID = "+TID+"");
while(result3.next()) {
String Tag = result3.getString("Tag_Name");
System.out.println(Tag);
newTag = newTag + Tag + "-";
} //end of third loop
}catch(java.lang.Exception e)
{return "catch 3";}
}// end of second loop
return newTag;
}catch(java.lang.Exception e)
{return e.getMessage();}
}//end of first loop
return newTag;
} //end of try
catch(java.lang.Exception e) {
return "catch 1";
}
}
result2 show that the resultset is closed...why? |
|
|
|
|
|
|
|
发表于 21-6-2006 09:14 AM
|
显示全部楼层
应该看看以下这行有没有任何 record:
result2 = query.executeQuery("select Tag_ID from tblWordTag where Word_ID = "+WID+""); |
|
|
|
|
|
|
|

楼主 |
发表于 21-6-2006 09:36 AM
|
显示全部楼层
原帖由 goatstudio 于 21-6-2006 09:14 AM 发表
应该看看以下这行有没有任何 record:
result2 = query.executeQuery("select Tag_ID from tblWordTag where Word_ID = "+WID+"");
有。。它跑好好的。。。
可是。。。。
当我分开来时。。
这样的问题。。。。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|