java - 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;
}
}
解决方案
推荐阅读
- php - 基于 WooCommerce 中的用户角色或自定义数据的额外购物车费用
- reactjs - 在服务器上构建 create-react-app 时防止停机
- python - 如何计算文本中词频的最佳 zipf 分布
- pandas - Pandas:如果不是 NaN 则打印(列)
- formatting - Freemarker 格式 BigDecimal 到德语区域设置无法正常工作
- haskell - 堆栈“计划构建失败。”
- python - 使用 python 生成示例(鸢尾花)数据集
- java - sendKeys() 未通过 Selenium 和 Java 使用 WebDriverWait 插入完整值
- oracle - 如何修复“遇到以下符号之一时遇到符号“=:”plsql中的错误
- python - 为什么 pyglet.image 和 texture 这么重?