request.setCharacterEncoding("UTF-8");
ResultSet rs = null;
Connection conn = null;
Statement stmt = null;
String Name="已出库";
try {
int pag = 0;
int num = 0;
int tsum = 0;
int intpag = 0;
String strpag = request.getParameter("pag");
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql:///logistics", "root", "root");
String sql = "select count(*) totalCount from allsort_menu where SortState= '"+Name+"'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
sql的值select count(*) totalCount from allsort_menu where SortState= '已出库'报错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 'where SortState= '已出库'' at line 1
ResultSet rs = null;
Connection conn = null;
Statement stmt = null;
String Name="已出库";
try {
int pag = 0;
int num = 0;
int tsum = 0;
int intpag = 0;
String strpag = request.getParameter("pag");
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql:///logistics", "root", "root");
String sql = "select count(*) totalCount from allsort_menu where SortState= '"+Name+"'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
sql的值select count(*) totalCount from allsort_menu where SortState= '已出库'报错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 'where SortState= '已出库'' at line 1
解决方案 »
- 关于数据持久化
- 反序列化失败,求助!
- 在jsp中是否可以省略基路径<base href=<%=basePath%>
- 帮助新手学习JSp
- Ext checkbox翻页后保存原来的选择状态
- 在myeclipse中在程序预览的时候控件可以显示,但是运行的时候就不出来了!
- 各位,请教个问题 : 我在远程的服务器上 建立了一个数据库,然后通过我的机器 把内容存到 服务器上的 表格里。怎么说,数据库不存在啊??可明明是有的,存在的。
- sitemesh和struts结合的时候,为什么返回.do的时候,页面加载不进来(页面框架没有啦)。请高手指点.
- 求教一个简单的问题!!
- 调用Action的问题,很苦恼,希望各位大虾尽快帮忙解决!
- tomcat下全局过滤器和项目中过滤器的执行顺序问题
- 求助:相对路劲读取文件却显示在tomcat目录下
jdbc:mysql:///logistics?useUnicode=true&characterEncoding=UTF-8
这里jsp直接请求数据库查询,只要检查自己的文件编码是否是GBK,
因为jsp文件会编译成java文件,如果编译完java是正确的中文,就不会有乱码,
可以去找下jsp对应的java文件查看是否已经是乱码了