每当我运行以下代码时,我都会收到错误“找不到列”,即使该列存在于我的表中。我正在使用access数据库,请寻求帮助
public class Trial1 {
public static void main (String[]args){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:SENSOR";
String user = "";
String pass = "";
Connection con = DriverManager.getConnection(url,user,pass);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); //stmt代表資料庫連接成功
ResultSet rs = stmt.executeQuery("select MAX(LevelNum) from NList");
if (rs.next()){
int w = rs.getInt("LevelNum");
int x= 3;
double i = Math.pow(2, (w-x))-1;
System.out.printf("i is %f",i);}
stmt.close();
con.close();
}catch(Exception e)
{
System.out.println("Error" + e);
}
}
}