How to edit the SQL statement using preparedStatement while using like the

Direct code on:
Normal mode:

String sql = "select * from tb_product where id=?";

        preparedStatement.setString(1,id);

When preparedStatement like and combined,
just so you can:

String sql = "select * from tb_product where id like ? ";

        preparedStatement.setString(1,"%"+id+"%");
Published 108 original articles · won praise 46 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_44739706/article/details/104571720