ho creato una tabella con 5 colonne (che rispecchiano le colonne del database al quale devo connettermi) e 20 righe.
il codice che ho usato per riempirla è:
ma mi da questo errore:codice:try { int id = 0; Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://....."); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from movimenti"); while (rs.next()) { for (int i = 0; i < 20; i++) { jTable1.setValueAt(rs.getString(i + 1), id, i); } } rs.close(); stmt.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); }
Column index out of range,6>5.
nn riesco a intrepretarlo perchè io sul db ho 5 colonne e nn 6.

Rispondi quotando