Topic: 使用jsp查询数据库中的值的问题

  Print this page

1.使用jsp查询数据库中的值的问题 Copy to clipboard
Posted by: cxc3980
Posted on: 2007-05-19 10:20

要实现一个通过查询数据库中值来使用JFreeChart画图的功能。
其中查询的代码如下:

while(rs.next())
{
String y0=rs.getString("MAX");
String y1=rs.getString("MEAN");
Float f0=Float.parseFloat(y0);
Float f1=Float.parseFloat(y1);
String s=rs.getString("DATETIME");
//从yyyyMMddHHmm时间格式的char中取出年月日设为int值
int x=Integer.parseInt(s.substring(0,4));
int y=Integer.parseInt(s.substring(5,7));
int z=Integer.parseInt(s.substring(8,10));
out.print(f0+" ");
out.print(f1+" ");
out.println(s+" ");
timeseries.add(new Day(z,y,x),f0);
timeseries1.add(new Day(z,y,x),f1);
}

加入的三个输出语句是为了测试是否将数据库的数据全部查询出来。
但是当没有

timeseries.add(new Day(z,y,x),f0);
timeseries1.add(new Day(z,y,x),f1);

这两行代码的时候,就能够输出所有的数据,当加上这两句时,就只能输出前两条数据,不知道是什么原因。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923