Ciao a tutti, io ho creato una JComboBox, dove i valori di questa sono i records di una tabella, funziona tutto, solo che SQL mi restituisce questo messaggio: "SQL ERROR: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Stato del cursore non valido.". Perché, e come posso risolvere il problema?
Questo è il codice
int count =0;
try{
Class.forName(class_driver);
}catch(java.lang.Exception exc){
System.out.println("Class Driver ERROR " + exc.toString());
}
try{
DBConnection = DriverManager.getConnection(url_connect1);
statement = DBConnection.createStatement();
rsQuery = statement.executeQuery("SELECT count(*) AS ID from tabella");
rsQuery.next();
count = rsQuery.getInt(1);
rsQuery.close();
statement.close();
items_indici = new String[countIndici];
statement2 = DBConnection.createStatement();
rsQuery2 = statement2.executeQuery("SELECT nome from tabella2 order by nome");
for(int z=0; z<=count; z++){
rsQuery2.next();
items_[z] = rsQuery2.getString(1);
}
rsQuery2.close();
statement2.close();
DBConnection.close();
}catch(java.sql.SQLException exc){
System.out.println("SQL ERROR: " + exc.toString());
}
recordPresenti = new JComboBox(items_);