public int write(ResultSet rs) throws IOException, SQLException {

		ResultSetMetaData md = rs.getMetaData();
		int colCount = md.getColumnCount();
		println("<table border=1>");
		print("<tr>");
		for (int i=1; i<=colCount; i++) {
			print("<th>");
			print(md.getColumnLabel(i));
		}
		println("</tr>");
		int rowCount = 0;
		while (rs.next()) {
			++rowCount;
			print("<tr>");
			for (int i=1; i<=colCount; i++) {
				print("<td>");
				print(rs.getString(i));
			}
			println("</tr>");
		}
		println("</table>");
		return rowCount;
	}