Struts问题,急急急!!!在线等!!!
错误如下:
sql.executeQuery:General error, message from server: "Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='"
executeQuery函数如下:
public ResultSet executeQuery(String sql)throws Exception{
rs=null;
try{
sql=new String(sql.getBytes("GBK"),"ISO8859_1");
conn=DriverManager.getConnection(sConnStr);
Statement stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
}
catch(SQLException ex){
System.out.println("sql.executeQuery:"+ex.getMessage());
}
return rs;
}
SQL语句如下:
db.executeQuery("select * from admin where UserName='"+username+"' and PassWord='"+password+"'");