语句肯定不正确。
String sql;
sql = "select a,b,c,d from t where a like '1%' and b like '%1'"
这样的语句看上去是没错,但是运行是不对的。like的用法注意使用"()".
sql = "select a,b,c,d from t where (a like '1%') and (b like '%1')"
这样就不错了。不知你的是不是这个问题。
:)
sql="select * from table1 where attribute1 like ?";
pstmt=conn.preparedStatement(sql);
attrValue="%"+attrValue+"%";
pstmt.setString(1,attrValue);
rset=pstmt.executeQuery();