public usuario localizaMail(String email) { String sql = "select email,login,senha from usuario where email = '" + email + "'"; usuario registro = new usuario(); try { Statement st = getCon().createStatement(); ResultSet rs = st.executeQuery(sql); if (rs.next()) { registro.setEmail(rs.getString("email")); registro.setLogin(rs.getString("login")); registro.setSenha(rs.getString("senha")); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Erro SQL:" + e.getMessage()); } return registro; }
public usuario localiza(String login, String senha) { // tipo='" + tipo + "' String sql = "select login,senha,tipo from usuario where login='******' and senha='" + senha + "'"; usuario registro = new usuario(); try { Statement st = getCon().createStatement(); ResultSet rs = st.executeQuery(sql); if (rs.next()) { registro.setLogin(rs.getString("login")); registro.setSenha(rs.getString("senha")); registro.setTipo(rs.getString("tipo")); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, "Erro SQL:" + e.getMessage()); } return registro; }