Jdbc.jilu(Zhu.i) 这个没有设置返回值,改写如下:
public static String jilu(int username)
{
String resultStr = "";
Connection con=null;
PreparedStatement stmt=null;
ResultSet rs=null;
try {
con=JdbcUtils.getConnection();
String sql="select oi and time from jilu where userid=?";
stmt=con.prepareStatement(sql);
rs=stmt.executeQuery(sql);
while(rs.next())
{
resultStr = rs.getInt("userid")+" "+rs.getInt("oi")+" "+rs.getInt("time");
resultStr = resultStr + "\n";
}
}catch(Exception e) {
e.printStackTrace();
}
finally {
JdbcUtils.close(rs, stmt, con);
}
return resultStr ;
}
resultStr 就是你要文本域里面设置值的参数。