编译java没有出现错误..
当我运行的时候出现了如下的错语,请问这是怎么回事???
Java.sql.SQLException: After end of result set
请高手指点一下
这道底是数据库的哪部份出错了或者程序哪里出错了,以前未碰到过
//package org.zl.marketleftad;
import org.zl.marketleftad.swf;
import org.zl.marketleftad.jdbc;//数据库连接
import java.util.*;
import java.io.*;
import java.sql.*;
/*
*****************************
path 文件路径
out_number 列数
*****************************
*/
class html1{
public String gethtml(String path,int out_number){
try{
String sql = "";
int i = 0;
String filePath = "";
String templateContent="asdasdasd";
String uppic,web,target_value;
//String title="This is Title";
//String content="This is Content Area";
//String editer="LaoMao";
jdbc db = new jdbc();
sql = "select * from advertise order by orders";
ResultSet rs = db.executeQuery(sql);
templateContent = "<table>";
while (i<out_number){ //从这里开始调用数据库
if (rs.next()){
uppic = rs.getString("uppic");
web = rs.getString("web");
target_value = "_blank";
if (web.equals("")){
web="#";
target_value = "";
}
}
else{
uppic="uppic/nopic.gif";
web="#";
target_value="";
}
templateContent = templateContent+"<tr><td width='102' height='60'><a href='"+web+"' target='"+target_value+"'>";
templateContent = swf.gettype(rs.getString("uppic"));
templateContent = templateContent+"</td></tr>";
i++;
} // 这里开始运行结果束
templateContent = templateContent+"</table>";
rs.close();
db.close();
filePath = path;
// 根据时间得文件名
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";
fileame = filePath+"/html/"+fileame;//生成的html文件保存路径
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
return ("文件生成成功!");
}
catch(Exception e){
return e.toString();
}
}
}
public class html{
public static void main(String arg[]){
System.out.println(new html1().gethtml("d:",17));
System.out.println("ok");
}
}
[此贴子已经被作者于2006-8-4 17:16:39编辑过]