大家不要笑我,提个弱智的问题先~

emoam 2003-07-01 09:48:55

以前我写后台的,现在没人写前台,我没事做的时候就写写前台喽,哪里一弄就到处出问题了。

听我慢慢道来啊。

我先在后台写了一个类,想法当然是在前台来调用这个类。

我想把这个类在窗口刚刚打开的时候实现初始化的,其中有这么一段,就是调用类的那一段,死活运行不下去了,情况如下:
     currenquery cq = new currenquery();
String str_itemname = null;
ResultSet rs_items = null;
rs_items = cq.InsertItembytablename("campany");
try {
if (rs_items == null) {
System.out.println("rs is null");
}
else {
System.out.println("rs is not null");
}
}
catch (Exception exx) {
System.out.println(exx.toString());
}
System.out.println("run to here");
try {
System.out.println("run to try");
while(rs_items.next()) {
System.out.println("run to while");
str_itemname = rs_items.getObject(1).toString();
System.out.println("run to here2");
//FieldsBox1.addItem(str_itemname);
FieldsBox1.insertItemAt(str_itemname, 0);
System.out.println("run to here3");
System.out.println("插入一个字段:" + str_itemname);
}
}
catch (Exception ex) {
System.out.println("运行异常,结果集可能为空");
}

运行结果如下:
rs is not null
run to here
run to try

不知道怎么着,我在后台写了一个main函数,运行得好好的,可以一直运行到最后,但在前台的时候,却怎么也只能运行到“run to try” ,后面的就不行了。。。

我都要急死了,讨厌死做前台啦,555555555555555,哪位GGJJ有耐心的帮我看一下,如果知道的,一定要告诉我啊。。。


...全文
23 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jeng 2003-07-03
  • 打赏
  • 举报
回复
hao
梦归零 2003-07-02
  • 打赏
  • 举报
回复
你把while(rs_items.next()) {
}部分改为

if (rs_items.next())
{}
else
{
System.out.println("55555555555555555555");
}
试试.看看有没有记录集.

50,539

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧