Ich habe ein Problem beim Abrufen der genaue Benutzer-Login-ID nach dem Login erfolgreich war, und es angezeigt auf einem Statustext-Feld in meinem Admin-RahmenWie abzurufen und einen Login-ID nach erfolgreichen Login angezeigt
public String i;
public String getId()
{
return this.i;
}
private void btnLogActionPerformed(java.awt.event.ActionEvent evt) {
String sql ="select * from ad where logId=? and password=?";
try{
pst = conn.prepareStatement(sql);
pst.setString(1,loginTxt.getText());
pst.setString(2,passTxt.getText());
rs = pst.executeQuery();
if(rs.next())
{
JOptionPane.showMessageDialog(null, "Username and password is correct"); i = rs.getString("logId");
rs.close();
pst.close();
AdminTable s = new AdminTable();
s.setVisible(true);
dispose();
}
else
{
JOptionPane.showMessageDialog(null, "Username and password incorrect");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
// Dies ist mein zweiter Frame, der Admin-Frame. Ich möchte die Anmelde-ID auf einer Textbox erscheinen automatisch, nachdem der Benutzer in Login lo = new Login(); public Admin() { initComponents(); jTextAdId.setText(lo.i); }
Was funktioniert nicht? Sie haben die Login-ID in 'loginTxt.getText()', was brauchen Sie mehr? –
Ich möchte die Login-ID in meinem Admin-Frame als Status – Maxwell
angezeigt werden, siehe: http://StackOverflow.com/Help/Someone-answers – c0der