Select Java TextArea

2 respostas
G

porque não esta funcionando

[size=5]public class RelatorioReserva extends JFrame{

private JTextArea resultado;

private String query,nome,curso;

private int codigo;

private  Statement stmt;

private ResultSet rs;

private PreparedStatement ps;

private ConectarPostgresql con;

private Connection conexao;
public RelatorioReserva() {
	super("Relatorio de Professores");
	setBounds(200,200,800,600);
	con = new ConectarPostgresql("postgres","postgres");
	conexao = con.conectar();
	resultado = new JTextArea(300,300);
	Container c = getContentPane();
	c.setLayout(new  FlowLayout());
	
try{
    stmt = conexao.createStatement();
	 rs = stmt.executeQuery("SELECT cod_prof, nome_prof,curso_prof FROM professor;");
	
	while (rs.next()) {
		codigo = rs.getInt("cod_prof");
		nome = rs.getString("nome_prof");
		curso = rs.getString("curso_prof");
		
		resultado.append("

");
resultado.append(“Codigo.:”+codigo+“Nome.:”+nome+“Curso.:”+curso);

}
      }			   
   
 catch ( SQLException sqlex ) {
	System.err.println( "Unable to connect" );
   sqlex.printStackTrace(); 
 } 
 c.add(resultado);

 show();

}[/size]

2 Respostas

cv1

Qual o problema, Gustavo?

G

não esta aparecendo no JTextArea
O select esta funcionando

Criado 19 de novembro de 2003
Ultima resposta 20 de nov. de 2003
Respostas 2
Participantes 2