com.microsoft.sqlserver.jdbc.SQLServerException: 结果集已关闭.
这是代码try{ResultSetrs=stmt1.executeQuery("SELECT*FROM词库");//Strings=jt2.getText().trim(...
这是代码
try {
ResultSet rs = stmt1.executeQuery("SELECT * FROM 词库");
//String s=jt2.getText().trim();
//System.out.print("b");
//System.out.print(rs.next());
while(rs.next()){
word = rs.getString("单词");
mean = rs.getString("释义");
//System.out.print(word.equals(jt1.getText()));
System.out.println(word+" "+mean);
if(!word.equals(jt1.getText())) {
String s1=jt1.getText().trim();
System.out.print(s1);
String s2=jt2.getText().trim();
System.out.print(s2);
String temp="INSERT INTO 词库 VALUES ('"+s1+"','"+s2+"')";
stmt1.executeUpdate(temp);
JOptionPane.showMessageDialog(null,"添加成功!","恭喜",
JOptionPane.WARNING_MESSAGE);
dispose();
}
} 展开
try {
ResultSet rs = stmt1.executeQuery("SELECT * FROM 词库");
//String s=jt2.getText().trim();
//System.out.print("b");
//System.out.print(rs.next());
while(rs.next()){
word = rs.getString("单词");
mean = rs.getString("释义");
//System.out.print(word.equals(jt1.getText()));
System.out.println(word+" "+mean);
if(!word.equals(jt1.getText())) {
String s1=jt1.getText().trim();
System.out.print(s1);
String s2=jt2.getText().trim();
System.out.print(s2);
String temp="INSERT INTO 词库 VALUES ('"+s1+"','"+s2+"')";
stmt1.executeUpdate(temp);
JOptionPane.showMessageDialog(null,"添加成功!","恭喜",
JOptionPane.WARNING_MESSAGE);
dispose();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询