0
Good morning, I have a question, I need to calculate a new password for each Patient when going through this method:
ps = getConexao().prepareStatement(SQL_VERIFICAR_PROTOCOLOS_PENDENTES);
ps.setDate(1, new java.sql.Date(dto.getData().getTime()));
ps.setDate(2, new java.sql.Date(dto.getData2().getTime()));
ps.setInt(3, dto.getIdCorp());
rs = ps.executeQuery();
while (rs.next()) { // fazendo a Busca pelo ResultSet
StringBuffer CalcSenha = new StringBuffer();
ArrayList<String> lista = new ArrayList<String>();
lista.add(rs.getString("nome"));
lista.add(rs.getString("data_nascimento"));
lista.add...........(pego dados do banco);
for (int i = 0; i < lista.size(); i++) {
CalcSenha.append(lista.lista.get(0));
System.out.println("A senha calculada foi:" + CalcSenha);
}
}
The calculation is made like this:
first letter of the name, position 7 of the date of birth; position 1 of date of birth; position 9 of the date of birth; position 1 of readroom; age at 3 positions; Total= 6 characters
I can get this data already with My ResultSet
, my doubt is I use the StringBuffer
giving append, as I go through and pick up the first letter of the Patient’s Name, the 7 position of the date of Birth...... ???
I’m not getting it, because the way it is Calcpassword.append(list.lista.get(0)); it pulls the whole name.
I did it that way, I found this substring and was parsing what I needed. Thank you.
– Arthur Edson