str="select * from goods where owner='"+user_id + "'";
char是字符串(可跟N个空格在后面)如果lz的user_id是字符串,需要这样必要才行 str="select * from goods where rtrim(owner)='"+user_id + "'"; str="select * from goods where owner LIKE '"+user_id + "%'";(这种不是很保险)
str="select * from goods where owner='"+ user_id + "'";
str="select * from goods where rtrim(owner)='"+user_id + "'";
str="select * from goods where owner LIKE '"+user_id + "%'";(这种不是很保险)