java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state

tc.exe

New Member
I created a simple application that compares a database value with a textfield value, but when I execute the project it gives me the following \[code\]Exception\[/code\]:\[quote\] \[code\]java.sql.SQLException\[/code\]: [Microsoft][ODBC Driver Manager] Invalid cursor state\[/quote\]This is the code I'm using:\[code\]private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { String dataSource ="testDb"; String U="jdbc:eek:dbc:"+dataSource; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection(U,"",""); PreparedStatement s=con.prepareStatement("Select * from student"); ResultSet s1=s.executeQuery(); String textField; textField=jTextField1.getText(); String database =s1.getString(1); if(textField.equals(database)) { System.out.println("ok"); } else { System.out.println("Not ok"); } } catch(Exception ex) { System.out.println("THE EXCEPTION IS"+ex); }}\[/code\]What could be the cause if this \[code\]Exception\[/code\]?
 
Top