郁闷,jsp中从mysql有条件查询数据居然出错!!!!!!!!!!!!!

yong427 yong427 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
郁闷,jsp中从mysql有条件查询数据居然出错!!!!!!!!!!!!!
代码如下:
/*
*对数据库操作函数(从数据库中查询记录)
*String--strSql:传入的SQL语句
*ResultSet--return:返回查询的ResultSet值
*/
public ResultSet OpeSqlRst(String strSql) throws SQLException,Exception{
ResultSet sqlRst;
try{
//Statement对象
sqlStmt = con.createStatement();
sqlRst = sqlStmt.executeQuery(strSql);
}catch(SQLException sen){
strError = sen.getMessage();
throw new SQLException(strError);
}catch(Exception en){
strError = en.getMessage();
throw new Exception(strError);
}
return sqlRst;
}
///////////////////////////////
如果strSql="select count(*) from user"则没有错误
//////////////////////////////
如果strSql="select count(*) from user where us_name='admin' and us_pwd='admin'"
则出现下列错误:
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: General error message from server: "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gb2312_chinese_ci,COERCIBLE) for operation '='"
请看看什么错误?????????????????????

...全文
评论 2
收藏 已收藏
分享
返回顶部
yong427
Web 开发 81,108 成员 341,721 内容