| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1812 人关注过本帖
标题:ResultSet cannot be resolved to a type
只看楼主 加入收藏
雪碧透心凉
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:40
专家分:131
注 册:2014-2-26
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
ResultSet cannot be resolved to a type
程序代码:
import java.sql.Connection;
import java.sql.Statement;

public class Demo03 {
    public static void main(String[] args) {
        Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")
                .newInstance();
        Connection con = java.sql.DriverManager.getConnection(
                "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=books",
                "sa", "java");
        Statement stmt = con.createStatement();
        ResultSet rst = stmt.executeQuery("select * from book");
        while (rst.next()) {
            System.out.println("<tr>");
            System.out.println("<td>" + rst.getString("bookId") + "</td>");
            System.out.println("<td>" + rst.getString("bookName") + "</td>");
            System.out.println("<td>" + rst.getString("publisher") + "</td>");
            System.out.println("<td>" + rst.getFloat("price") + "</td>");
            System.out.println("</tr>");
        }

        rst.close();
        stmt.close();
        con.close();
    }
}

执行后,提示这个错误:ResultSet cannot be resolved to a type,谁给点提示
搜索更多相关主题的帖子: microsoft cannot 
2014-03-22 12:31
zjcl817
Rank: 4
来 自:残狼部落
等 级:业余侠客
威 望:2
帖 子:68
专家分:206
注 册:2013-11-11
收藏
得分:20 
你的只好像是一个连接数据库的程序??
2014-03-23 22:23
雪碧透心凉
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:40
专家分:131
注 册:2014-2-26
收藏
得分:0 
回复 2楼 zjcl817
嗯,最近在研究怎么链接数据库。已经找到原因了。

  assume nothing,do more, need less,smile often and realize how fortunate you are right now.
2014-03-24 09:47
快速回复:ResultSet cannot be resolved to a type
数据加载中...
 
   



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

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