取不了表中的字段值???

dreamlins 2006-03-15 09:19:33
String id1=request.getParameter("id");
int id2=Integer.parseInt(id1);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:mybbs";
String username="";
String password="";
Connection con=DriverManager.getConnection(url,username,password);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from title_info inner join user_info on user_info.mnum=title_info.mnum where topicid="+id2); //
if(rs.next())
{
//String regtime=rs.getString("regtime");出错,在表user_info中的字段
//String ip=rs.getString("ip");出错,在表user_info中的字段
String sendtime=rs.getString("sendtime");在表title_info中的字段
String content=rs.getString("content");在表title_info中的字段

好象只select了表title_info中的字段值.
但在user_info中也有部分字段值无法读取.
...全文
140 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
dreamlins 2006-03-17
  • 打赏
  • 举报
回复
我是想选择三个表中合符topicid=id2的所有字段值..然后输出..但使用上面语句后输出的结果只有少部分字段能选择,如选择不能选的字段,则出现"无效的游标状态"的错误.
dreamlins 2006-03-17
  • 打赏
  • 举报
回复
我是想选择三个表中合符topicid=id2的所有字段值..然后输出..但使用上面语句后输出的结果只有少部分字段能选择,如选择不能选不了的字段,则出现"无效的游标状态"的错误.
dreamlins 2006-03-17
  • 打赏
  • 举报
回复
对啊...应该是select语句的问题..看看这条语句有没有错误:
ResultSet rs=stmt.executeQuery("select * from title_info,user_info,reply_info where user_info.mnum=title_info.mnum
and title_info.mnum=reply_info and topicid="+id2);
dreamlins 2006-03-16
  • 打赏
  • 举报
回复
还是不行啊..我用的是sql server2000很多个页面都出现了这样的错误.
wangx1949 2006-03-16
  • 打赏
  • 举报
回复
用getString(colnum)取
dreamlins 2006-03-16
  • 打赏
  • 举报
回复
错误描述标识符
xiongbing528 2006-03-16
  • 打赏
  • 举报
回复
等下帮你看看 。/
天外流星 2006-03-16
  • 打赏
  • 举报
回复
("select * from title_info inner join user_info on user_info.mnum=title_info.mnum where topicid="+id2)
这条语句有问题.
dreamlins 2006-03-15
  • 打赏
  • 举报
回复
好象是"错误的标识符"错误..
fbtdjs 2006-03-15
  • 打赏
  • 举报
回复
什么错误?
interpb 2006-03-15
  • 打赏
  • 举报
回复
String regtime=rs.getString("user_info.regtime");试试

或者用getString(colnum) 来取


81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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