首页 > 解决方案 > PSQLException:在此 ResultSet 中找不到列名“blah”

问题描述

我已经被这个错误困住了一段时间,但我觉得我可能只是犯了一个小错误。我曾尝试擦除课程并重建它,但无济于事。我也尝试过删除 PostgreSQL 中的表并重新构建它,但它没有用。当我在连接列表中切换 ResultSet 位置时,它总是第二个参数不起作用。如果您能发现任何问题,我将不胜感激!顺便说一句,这是Java。我收到异常:“ org.postgresql.util.PSQLException:在此 ResultSet 中找不到列名 connect_name。” 在下面的代码中。

    String friendsSelect = "SELECT * FROM public.connect WHERE(username_='"+ loginUsername.toUpperCase() +"' OR connect_name='"+ loginUsername.toUpperCase() +"' AND complete_='YES');";

    connectList.add(new Connect(rs.getString("username_"),rs.getString("connect_name"),rs.getString("complete_"), rs.getString("date_"),rs.getString("username_image"),rs.getString("friendname_image"),rs.getString("online_user"), rs.getString("connect_online")));

    public class Connect {
    private String username;
    private String friendname;
    private String complete;
    private String datestring;
    private String user_image;
    private String friendImage;
    private String online;
    private String friend_online;


    public Connect(String username, String friendname, String complete, String datestring, String user_image, String friendImage, String online, String friend_online) {
        this.username = username;
        this.friendname = friendname;
        this.complete = complete;
        this.datestring = datestring;
        this.user_image = user_image;
        this.friendImage = friendImage;
        this.online = online;
        this.friend_online = friend_online;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getFriendname() {
        return friendname;
    }

    public void setFriendname(String friendname) {
        this.friendname = friendname;
    }

    public String getComplete() {
        return complete;
    }

    public void setComplete(String complete) {
        this.complete = complete;
    }

    public String getDatestring() {
        return datestring;
    }

    public void setDatestring(String datestring) {
        this.datestring = datestring;
    }

    public String getUser_image() {
        return user_image;
    }

    public void setUser_image(String user_image) {
        this.user_image = user_image;
    }

    public String getFriendImage() {
        return friendImage;
    }

    public void setFriendImage(String friendImage) {
        this.friendImage = friendImage;
    }

    public String getOnline() {
        return online;
    }

    public void setOnline(String online) {
        this.online = online;
    }

    public String getFriend_online() {
        return friend_online;
    }

    public void setFriend_online(String friend_online) {
        this.friend_online = friend_online;
    }
}

标签: javasqlpostgresql

解决方案


推荐阅读