Home > Back-end >  SQL statement to determine gender in page shows garbled, thanks to the warrior guidance!!!!!! thank
SQL statement to determine gender in page shows garbled, thanks to the warrior guidance!!!!!! thank

Time:11-22

Database using the mysql database, sex field definition is type TINYINT default 20 size


The background SQL statements below
String SQL="select ti. User_id as' user_id ',"
+ "ti user_name as" user_name ", "
+ "(CASE WHEN ti. User_sex=0 THEN 'no choice'
"+ "the WHEN ti. User_sex=1 THEN 'male'"
+ "the WHEN ti. User_sex=2 THEN 'female'"
+ "ELSE" '
"+ "END) as' user_sex,"
+ "ti user_mail as' user_mail ',"
+ "ti user_tel as' user_tel,"
+ "ti user_address as' user_address,"
+ "ti user_create_time as' user_create_time ',"
+ "ti user_rank_id as' user_rank_id ',"
+ "ti user_dept_id as' user_dept_id '"
+ "from t_user_info ti";

The JSP page (pageEncoding (GBK and utf-8 are used))
Use & lt; Logic: iterate> The tag

CodePudding user response:

You set the database character set and code is different, lead to user_name and sex you always is not the same as the character set
  • Related