Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page formatting is slowing Record Retrieval

Status
Not open for further replies.

Rexolio

Technical User
Aug 29, 2001
230
Basically, I have a formatted web page that returns results from a SQL database and displays them in tables, almost like a spreadsheet. I tried removing all but one of the results fields and it still took forever. Yet when I removed all of the formatting leaving only the results and a simple <BR> line break to begin the next record, the results zapped onto the screen in a split second.

I have already optimized my database and ASP script, and because of my &quot;ruling-out&quot; process as stated above, it comes down the formatting. Don't know if its because its creating a new table for each record or what, but its a problem. There are 80 fields from the database that I return (a lot!!!)

I NEED the formatting. Its all basic table and font tags...no images. Any suggestions on this?
 
FYI...I'm not wanting to &quot;page&quot; the results by only returning so many at a time. Its for clients to print and I don't want them having to page through several pages and print each one.

Thanks in advance!!!
 
Well, if you place all your results in one table, even using nested tables inside that table, then the HTML will not render itself until the </table> tag is buffered to the response object...

So that if you had 10 tables all completely independent of each other in their layout, then as each </table> tag is response.write()en to the page, then each table would render, one on top of the other (Personally, I prefer this method of output if possible, but sometimes it isn't feasable) --

Whereas if all ten of those tables were formatted to be nested tables inside one encompassing table that took up the whole page, then none of the output would show up until the overriding </table> tag was output....

Does that make sense?

One other thing to keep in mind is the response.buffer property of ASP pages... It is a property that you can set to either TRUE or FALSE, but has a default value if you don't set it, and that depends on what version of ASP your particular webserver is running...

in ASP 2, the default value is FALSE

in ASP 3, the default value is TRUE

What it does is tells your server to either save up all the response.write()s that you issue into one great big dump (TRUE), or issue them to browser as you issue them in your code (FALSE) --

Keeping these key issues in mind, you should be able to come up with results you can live with.

hope that helps! :)
Paul Prewett
penny.gif
penny.gif
 
Rexolio,

I think I know your headache. I had a similar one in that I was returning large HTML documents for printing. This was back when I was an HTML beginner and I thought that in order to get the font style I wanted, I had to place the <font>..</font> tags inside of every <td>..</td> tag.

Then I learned to use styles to format my documents. Now if you're already implementing styles in your HTML or are already well versed on styles, you probably won't learn much here from me. But if you are not, please read on..


Here's an example of my before and after.

Before I learned to use styles.

<html>
<head>
</head>
<body>

<!-- Row #1 -->
<tr>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 1 Field 1</strong>
</font>
</td>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 1 Field 2</strong>
</font>
</td>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 1 Field 3</strong>
</font>
</td>
</tr>

<!-- Row #2 -->
<tr>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 2 Field 1</strong>
</font>
</td>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 2 Field 2</strong>
</font>
</td>
<td width=&quot;20&quot;>
<font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#808080&quot;>
<strong>Record 2 Field 3</strong>
</font>
</td>
</tr>

</body>
</html>


After I learned some basic STYLE techniques

<html>
<head>
<style>
td {
font-family: Verdana, Arial;
font-size: 10pt;
font-color: #808080;
font-weight: bold;
}
</style>
</head>
<body>

<!-- Row #1 -->
<tr>
<td width=&quot;20&quot;>Record 1 Field 1</td>
<td width=&quot;20&quot;>Record 1 Field 2</td>
<td width=&quot;20&quot;>Record 1 Field 3</td>
</tr>

<!-- Row #2 -->
<tr>
<td width=&quot;20&quot;>Record 1 Field 1</td>
<td width=&quot;20&quot;>Record 1 Field 2</td>
<td width=&quot;20&quot;>Record 1 Field 3</td>
</tr>

</body>
</html>


There's an obvious difference in the amount of data returned and both documents were formatted identically. Now, I'm new to this and I'm aware that I've only given you a small example of the power of STYLES. Also, I've only tested this in Netscape 6. It works fine in IE. I don't know how earlier versions of Netscape handle this.

Again, my example is very basic. You can assign many more formatting parameters using the style method. In my example, I've assigned the style to the td tag. I have noticed that in Netscape 6, it is case sensitive. So if you write...


<style>
td {
font-family: Verdana, Arial;
font-size: 10pt;
font-color: #808080;
font-weight: bold;
}
</style>


with the td in lower case and you write your html like this ..


<TD WIDTH=&quot;20&quot;>Data</TD>


Netscape won't apply the style.

Furthermore, I've seen classes used in styles so that you can assign a class that has been defined in the <style>..</style> tags like this.


<td class=&quot;someclass&quot;>Data</td>


That way you can have multiple style templates, written only once at the top of the document, then apply them as needed in your html with just a few characters.

Unfortunately, I'm a beginner when it comes to styles. But I have found a really great tool that helps me understand the power of styles and classes. What I do is format a basic Excel sheet with multiple columns and rows. I put different formatting on different cells then I Save As Web Page. Then I look at the source web page document and it really shows the power of styles.

I hope this helps.

TW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top