com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'd_name' in 'where clause'我代码里写的都是dempName, 找不到d_name我删了重写,他还是这个错误com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'd_name' in 'where clause' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1612) at com.zrrd.web.demp.dao.DempDaoImpl.queryForList(DempDaoImpl.java:50) at com.zrrd.web.demp.service.DempServiceImpl.queryForList(DempServiceImpl.java:23) at com.zrrd.web.demp.servlet.DempServlet.queryForList(DempServlet.java:173) at com.zrrd.web.demp.servlet.DempServlet.service(DempServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619)
9 回答
大咪
TA贡献785条经验 获得超332个赞
"select * from demp where dempName like '%"+name+"%'"
这个sql语句明显有错误啊,是你截图过来有错还是什么问题,'%',应该这样写啊,
"select * from demp where dempName like '%'+name+'%'"
添加回答
举报
0/150
提交
取消