我的代码中出现“无效的游标状态”错误。我在访问结果集之前使用了next()仍然得到相同的错误

时间:2015-02-22 09:48:48

标签: java mysql database jdbc-odbc

每当我尝试在valut中存储rsc.getString(2)的值时,我都会收到错误。

ArrayList<Integer> rowc = new ArrayList<>();
         System.out.println("Select timing," + dayname + " from " + classid);
         rsc = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE).executeQuery("Select timing," + dayname + " from " + classid);
         String valut="";
                                while (rsc.next()) {
                                   valut=rsc.getString(2);
                                    if (!valut.equals("")) {


                                        //valut=rsc.getString(2);
                                       // if(rsc.getString(2).contains("LEC") ||rsc.getString(2).contains("prac") || rsc.getString(2).contains("tut"))
                                       // if(!valut.contains("LEC") && (valut.contains("prac") || valut.contains("tut")) && !valut.contains("LEC(1)"))
                                        if(valut.contains("LEC") ||valut.contains("prac") || valut.contains("tut"))
                                        { rowc.add(rsc.getRow());
                                        rsc.next();
                                        }

                                    }
                                }

0 个答案:

没有答案