SELECT * FROM T_DUTY WHERE dutyDate Between #2010-09-08# And #2010-09-09#java.sql.SQLException:No data foundat sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)at sun.jdbc.odbc.Jdbc

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 08:08:42
SELECT * FROM T_DUTY WHERE dutyDate Between #2010-09-08# And #2010-09-09#java.sql.SQLException:No data foundat sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)at sun.jdbc.odbc.Jdbc
xV]OG++u,66` l'$JE}݉a=̎ DJQQCʟw?llǀ~͞9{z@LoģI#譛Bg/h\P|&81˜]=?rDIMJܹUJ.}Jq$ܥY2.Kp˚2SQ&aR .bD TjQ#q^v 6=qhm1KF'co_C59 }8P P7iFRbk]& $ NHb7947ql@_<ކ;`]h=Oץiui X *݈}xPfK2$ɔaiH5 +M#H*)AZ:x ωv7R:w u>GZ{ۮ9`Q am֜:i{4YTC()kv}wL=4NR*mڸG1&˜2)Jg(C ҭ2t3\X}.L:>ی0]wfb+n;C‘SjǨs|Hldݎnjf RDv_qJeʲDl.jnHJJFpN? Q~l_Z5\GK;ba{PZp}h5QW翯>*<-'&^\ܩd/w}uA?dGXX<8B䋅 ĿXx\9~^>̛__V htz+mV7f+sߙ?n33*؛_7v~O,Ę&"({䵘ec =x?epYjILR'i,g9c}nE$0V5,N _xwwbf9TdFdQeƈ]&xJ8jqt9?Q2G<< x>-JPd k%^eHi%,Æbu*tV("(\kgiAl,kN8$

SELECT * FROM T_DUTY WHERE dutyDate Between #2010-09-08# And #2010-09-09#java.sql.SQLException:No data foundat sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)at sun.jdbc.odbc.Jdbc
SELECT * FROM T_DUTY WHERE dutyDate Between #2010-09-08# And #2010-09-09#
java.sql.SQLException:No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5698)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:354)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:411)
at com.dao.DutyDaoImpl.queryByTimeSpace(DutyDaoImpl.java:240)
at com.servlet.DutyRoster.queryByTimeSpace(DutyRoster.java:164)
at com.servlet.DutyRoster.doPost(DutyRoster.java:73)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
用的Access数据库,当查询一段时间内的记录时报错,在Access里面测试Sql语句输入正确,数据库里面有数据

SELECT * FROM T_DUTY WHERE dutyDate Between #2010-09-08# And #2010-09-09#java.sql.SQLException:No data foundat sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)at sun.jdbc.odbc.Jdbc
access不能在一个字段上连续多次调用 rs.getString("字段名"),你需要先定义一个变量保存
代码:
conn = DriverManager.getConnection(url,"sa","sa");
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next()) {
//System.out.println(sql);
CourseBean bea=new CourseBean();
System.out.println("#######"+rs.getString("tcno"));
bea.setTcno(rs.getString("tcno"));
bea.setCname(rs.getString("cname"));
bea.setGrade(rs.getString("grade"));
bea.setDescri(rs.getString("descri"));
ve.add(bea);
}
} catch (SQLException sqle) {
sqle.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("finish");
return ve;
}
原因:
如上面的代码,rs.getString("tcno")被使用两次,这是不可以的,如果要重复使用数据库的结果可以,将结果赋值给中间变量.