How come the main frame does'nt appear though the username and pw s correct

Here is a line from my program...I compiled ant run it successfully...but the main frame(Arch Main) does'nt seem to appea...only the JOptionPane message dialog....

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try{

MyDBConnection jdbc = new MyDBConnection();

jdbc.init();

Connection conn = jdbc.getMyConnection();

Statement stmt = conn.createStatement();

System.out.println(jTextField1.getText());

System.out.println(jPasswordField1.getPassword());

stmt.execute("select * from account where user='" + jTextField1.getText() + "' and password='" + jPasswordField1.getPassword() + "'");

ResultSet rs = stmt.getResultSet();

//this line does'nt seem to work...

if(rs.next()) {

ArchMain a = new ArchMain();

a.setVisible(true);

this.setVisible(false);

} else {

JOptionPane.showMessageDialog(null,"Invalid user or password","ERROR",JOptionPane.ERROR_MESSAGE);

}

}catch(Exception ex) {

ex.printStackTrace();

}

}

--

[1095 byte] By [ryshi1264a] at [2007-11-27 4:30:36]
# 1

Before the stmt.execute line add the following:

System.out.println("select * from account where user='" + jTextField1.getText() + "' and password='" + jPasswordField1.getPassword() + "'");

(I.E. copy the stmt.execute line and change stmt.execute to System.out.println)

Then, execute that printed statement in your DB tool to see what it produces. You may also wish to change

stmt.execute("select * from account where user='" + jTextField1.getText() + "' and password='" + jPasswordField1.getPassword() + "'");

ResultSet rs = stmt.getResultSet();

to

ResultSet rs = stmt.execute("select * from account where user='" + jTextField1.getText() + "' and password='" + jPasswordField1.getPassword() + "'");

But that may simply be more of a style thing.

masijade.a at 2007-7-12 9:39:55 > top of Java-index,Desktop,Core GUI APIs...