今天学习了模糊查询主要是用了sql语句的拼接
String sql = "select * from rkpc where ";
if (name != "") {
sql += "name like '%" + name + "%'";
}
if (sex != "") {
sql += "sex like '%" + sex + "%'";
}
if (mz != "") {
sql += "mz like '%" + mz + "%'";
}
if (shoujiao != "") {
sql += "shoujiao like '%" + shoujiao + "%'";
}
根据传入的参数来拼接sql语句来实现模糊查询的功能。