boa tarde estou tentando uma consulta do banco de dados e colocar em caixa de texto, a consulta retornar,mas vem o ultimo registo e quero o primeiro, segue abaixo o codigo. Obrigado
Statement statemente=conexaoPesquisar.conectarBanco().prepareStatement(lconsultarAlunos);
ResultSet rsCarregarDados;
rsCarregarDados=statemente.executeQuery(consultarAlunos);
while (rsCarregarDados.next()){
Alunos al= new Alunos();
al.setCodigo_aluno(rsCarregarDados.getInt("codigo_aluno"));
jTPesquisa.setText(rsCarregarDados.getString("codigo_aluno"));
tfNomeAluno.setText(rsCarregarDados.getString("nome_aluno"));
//jCbSexo.geti(rsCarregarDados.getString("nome_aluno"));
tfEndereco.setText(rsCarregarDados.getString("endereco"));
tfBairro.setText(rsCarregarDados.getString("bairro"));
tfCidade.setText(rsCarregarDados.getString("cidade"));
}