郁闷,jsp中从mysql有条件查询数据居然出错!!!!!!!!!!!!!
郁闷,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 '='"
请看看什么错误?????????????????????