The method setString(int, String) in the type PreparedStatement is not applicable for the arguments (int, String[])出现这种情况怎么办java web
The method setString(int, String) in the type PreparedStatement is not applicable for the arguments (int, String[])
java web 出现这种情况怎么办
我的user类里面定义的是 private String[] favorate;
在接口中定义的是
public interface UserDao {
public boolean add(User user);
}
在实现类的方法中这么写
public class UserDaoImpl extends SuperOpr implements UserDao {
public boolean add(User user) {
sql = “insert into user_info (favorate) values(?)”;
try {
psmt.setString(1, user.getFavorate());
row = psmt.executeUpdate();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return row>0?true:false;
}
}
然后在实现类里面报错
请教各位大神 这样应该怎么搞