条件查询,语句只有一个是需要查询的字段,剩下的全部从数据库中取
if(name.equals("")) {name=".*?";}
if(sex.equals("")) {sex=".*?"}
if(age.equals("")) {age=".*?";}
if(grade.equals("")) {grade=".*?";}
if(number.equals("")) {
number=".*?";
}
String url="select * from stu where name REGEXP? and sex REGEXP? and age REGEXP? and grade RE GEXP? and number REGEXP? ";
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'REGTEXP'.?' and sex REGTEXP'女' and age REGTEXP'.?' and grade REGTEXP'.*?' an' at line
暂时没有
能够查询出来
为什么你上面是REGEXP,下面是REGTEXP