Só pra lembrar estou usando o Netbeans 6.1
Estou tentando popular um jtable e está dando java.lang.ArrayIndexOutOfBoundsException
Segue o código
String consulta = this.txtConsulta.getText();
Connection conn = Conexao.getInstance().getConnection();
try {
String sql = "SELECT Codigo,RazaoSocial,Telefone,Fax FROM EMPRESA WHERE RAZAOSOCIAL LIKE ?";
PreparedStatement sta = conn.prepareStatement(sql);
sta.setString(1, "%" + consulta + "%");
ResultSet rs = sta.executeQuery();
while (rs.next()) {
Empresa emp = new Empresa();
jtTabela.setValueAt(rs.getInt(1),0,100);
jtTabela.setValueAt(rs.getInt(2), 101, 200);
jtTabela.setValueAt(rs.getInt(3), 201, 300);
jtTabela.setValueAt(rs.getInt(4), 301, 400);
}
rs.close();
sta.close();
} catch (SQLException e) {
e.printStackTrace();
}