Java搜索database时,出现 非法的游标状态 报错
SQLException: [Microsoft][ODBC 驱动程序 管理器] 非法的游标状态
String url="jdbc:odbc:waterprocess";
String cs1="select Logical_Address, Colour from Display_Name where DisplayName='LT560'";
String cs2="select TimeInsert, Value from HISTORY_INFO where DateInsert = '"+date+ "' , Logical_Address='" +logical+ "' and TimeInert between " +timefrom +" and "+timeto+"'";
Connection con=null;
Statement stmt=null;
ResultSet rs =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException:");
System.err.println(e.getMessage());
}
try {
con=DriverManager.getConnection(url);
stmt=con.createStatement();
rs= stmt.executeQuery(cs1);
//rs.next();
logical = rs.getString("Logical_Address");
color=rs.getString("Colour");
rs= stmt.executeQuery(cs2);
while(rs.next()) {
String time=rs.getDate("TimeInsert").toString();
String value = rs.getString("Logical_Address");
for(t=0;;t++){
result[t][0]=time;
result[t][1]=value;
}
}
stmt.close();
con.close();
}catch(SQLException ex) {
System.err.println("SQLException: "+ex.getMessage());
}
程序哪里出错了啊