3
how to perform the survey LIKE 'c%'
with PreparedStatement
?
I have the following code:
PreparedStatement pstm;
ResultSet rs;
public void pesquisarAdministrador(){
String sql = "SELECT administrador.idadministrador, administrador.usr_adm FROM administrador WHERE usr_adm LIKE ?";
try {
pstm = conn.prepareStatement(sql);
pstm.setString(1,"%" + txtId.getText() + "%'");
rs = pstm.executeQuery();
tblAdministrador.setModel(DbUtils.resultSetToTableModel(rs));
} catch (SQLException error) {
JOptionPane.showMessageDialog(null, error);
}
}
however it does not return anything, but when I remove the tables and put *
he brings normal.
My wobble was not
txtId.getText()
and yestxtbuscar.getText()
– Hebert Lima
@Hebertdelima hahaha, is part :)
– Maicon Carraro