手机外套批发:select * from im_users where Id = '"+id+"' and password = '11' 那里错了?

来源:百度文库 编辑:高校问答 时间:2024/05/01 02:13:37
select * from im_users where Id = '"+id+"' password = '11' 那里错了?
select * from im_users where Id = '"+id+"' and password = '"+password+"'
报错
java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
到底那里错了?

select * from im_users where Id = '"+id+"' and password = '11'
另外如果你的ID字段是数值型的,就这样
select * from im_users where Id = "+id+" and password = '11'
记得多条件查询,各个条件之间要用and或者or连接。

一般你应该是做为一个字符串的。
比如;
sqlString = "select * from im_users where Id ='"+this.tbxID.Text+"'";
其他的同样参照

少了条件连接符