请问这小段代码有什么问题?distinct & SQLException
Jay02 2002-06-01 08:01:21 try {
rs = st.executeQuery("select distinct 分类 from 表");
while(rs.next()) {
String type = rs.getString(1);
if (type == null) type = "(未分类)";
classes.addLast(type);
}
}
catch (SQLException e) {
System.out.println(e);
}
运行时:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
程序不退出。
去掉 SQL 语句中的 distinct 则没有问题,为何?
ps, 数据库用的是Access,使用JDBC-ODBC,但不建数据源
高手请指教。多谢!