| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 458 人关注过本帖
标题:请大家给解决个问题!谢谢先
只看楼主 加入收藏
adai007
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-8-18
收藏
 问题点数:0 回复次数:2 
请大家给解决个问题!谢谢先
开发BBS系统,用的环境是lomoz ecplise3.2 ,sqlserver2000 dep ,在运行下面这个页面的时候,TOMCAT SERVER提示:
root cause

[bo]javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not re-read row data for column 1.[/bo]

编码如下:

<%@ page language="java" contentType="text/html; charset=gbk"
    pageEncoding="gbk"%>
<%@ page import="java.sql.*" %>

<%!
String str = "";

private void tree(Connection conn, int id, int level) {
    Statement stmt = null;
    ResultSet rs = null;
    String preStr = "";
    for(int i=0; i<level; i++) {
        preStr += "----";
    }
    try {
        stmt = conn.createStatement();
        String sql = "select * from article where pid = " + id;
        rs = stmt.executeQuery(sql);
        String strLogin = "";
        
        while(rs.next()) {
            
            str += "<tr><td>" + rs.getInt("id") + "</td><td>" +
                   preStr + "<a href='ShowArticleDetail.jsp?id=" + rs.getInt("id") + "'>" +
                   rs.getString("title") + "</a></td>" +
                   strLogin +
                   "</td></tr>";
            if(rs.getInt("isleaf") != 0) {
                tree(conn, rs.getInt("id"), level+1);
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        try {
            if(rs != null) {
                rs.close();
                rs = null;
            }
            if(stmt != null) {
                stmt.close();
                stmt = null;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
%>

<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url1 ="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=bbs";
String url2 ="sa";
String url3 ="sa";
Connection conn =DriverManager.getConnection(url1,url2,url3);


Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from article where pid = 0");
String strLogin = "";
while(rs.next()) {
    
    str += "<tr><td>" + rs.getInt("id") + "</td><td>" +
           "<a href='ShowArticleDetail.jsp?id=" + rs.getInt("id") + "'>" +
           rs.getString("title") + "</a></td>" +
           strLogin +
           "</td></tr>";
       if(rs.getInt("isleaf") != 0) {
           tree(conn, rs.getInt("id"), 1);
       }
}
rs.close();
stmt.close();
conn.close();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>Insert title here</title>
</head>
<body>
<a href="Post.jsp">发表新帖</a>
<table border="1">
<%= str %>
<%
str = "";

%>
</table>
</body>

</html>
搜索更多相关主题的帖子: 有问题啊! 
2008-08-18 18:27
huwangvs
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:764
专家分:0
注 册:2007-2-4
收藏
得分:0 
根据错误提示找贝。
ResultSet can not re-read row data for column 1.
找不到原因就google.

是ms的驱动问题。。。。
网上一堆,搜了就看见了。。。。
2008-08-19 09:30
wangtianhong
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-10-30
收藏
得分:0 
re:
数据源是否配置正确
建议在写代码的时候多增加些捕获异常的代码
这样能查出原因
2008-08-19 09:50
快速回复:请大家给解决个问题!谢谢先
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017812 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved