gpt4 book ai didi

java - 从 mysql java 获取错误 "before start of result set"

转载 作者:行者123 更新时间:2023-11-29 02:11:51 24 4
gpt4 key购买 nike

<分区>

您好,我在以下代码中收到一条错误消息:

public Component createComponents(){
Panel pane = new Panel();
try{
Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/tondb?useSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC","root","");
Statement myStmt = myConn.createStatement();
ResultSet myRs = myStmt.executeQuery("select * from activeemployees");
ResultSet myRs2 = null;
while (myRs.next()) {
myRs2 = myStmt.executeQuery("SELECT * FROM employee WHERE ID="+myRs.getString("IDnumber"));
pane.add(new Label(myRs2.getString("firstName")+","+myRs.getString("lastName"),20,20));
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
return pane;
}

附上图片:

enter image description here

不明白为什么。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com