when i use prepared statement in SQL Server 2000, i found the problem addressed in "LIKE" operator.
pstmt = con.prepareStatement("select * from userinfo where userName like ?");
pstmt.setString(1,"'rickey%'");
rs = pstmt.executeQuery() ;
while (rs.next()){
......
......
it doesn't works! but if i copy the whole string"select * from userinfo where userName like 'rickey%'" in SQL Server query analyzer, it can select out the result. why? should I use another character instead of "?" ?
please help me.....