Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void consultarAluno()
- {
- try{
- setId(Integer.parseInt(JOptionPane.showInputDialog("Digite o ID do Aluno")));
- Connection conexao = DriverManager.getConnection("jdbc:mysql://localhost/bd_eclipse", "root", "etecjau");
- PreparedStatement st = conexao.prepareStatement("select * from Alunos whwre id=?");
- st.setInt(1, getId());
- ResultSet rs = st.executeQuery();
- while(rs.next())
- {
- JOptionPane.showMessageDialog(null, "Nome: " + rs.getString("nome") + "\nCurso: " + rs.getString("curso"));
- }
- conexao.close();
- }
- catch(Exception e)
- {
- JOptionPane.showMessageDialog(null, "Falha na Consulta");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement