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,谁给点提示