I have two problems
1) I want to display the customer details like account number, name, dob, etc. in a different customer account frame (written in another class) and hence I want that the same username that I logged in with, to use in the select query( i.e. select * from [tablename] where [the sameusername I logged in with] ) in the customer account page. How can I do that?
2) When checking for validity of username and password it works fine when I type in a username that exists in the database. But for any other username it does not display and error.
{
un1 = tusername.getText();
String p1 = new String(tpassword.getPassword());
query="select * from customer.details;";
ResultSet rs = smt.executeQuery(query);
if(un1.equals("") && p1.equals(""))
{
JOptionPane.showMessageDialog(null, "Enter your username and password","Error", JOptionPane.ERROR_MESSAGE);
}
else if (un1.equals(""))
{
JOptionPane.showMessageDialog(null, "Please enter your username","Error", JOptionPane.ERROR_MESSAGE);
}
else if (p1.equals(""))
{
JOptionPane.showMessageDialog(null, "Please enter your password","Error", JOptionPane.ERROR_MESSAGE);
}
else
while(rs.next())
{
if(un1.equals(rs.getString("cust_username")))
{
if(p1.equals(rs.getString("cust_password")))
{
CustomerBankingPage cbp = new CustomerBankingPage();
cbp.custbanklaunch();
loginframe.setVisible(false);
}
else
{
JOptionPane.showMessageDialog(null, "Username/Password do not match","Error", JOptionPane.ERROR_MESSAGE);
}
}