Displaying Recordset results as page loads.....

Results 1 to 5 of 5

Thread: Displaying Recordset results as page loads.....

  1. #1
    Join Date
    Dec 1969
    Posts
    572

    Default Displaying Recordset results as page loads.....

    I have a page that displays an Access table with about 350 records in it. The problem is that before the table is displayed, it must finish loading the entire table. This takes too long. How do i have ASP write to the page as it reads the database? I&#039ve seen this done before, only i&#039m not sure how. How would i adjust the current code below to accomplish this task?<BR><BR>&#060;% <BR>&#039 ASP program that displays a database in table form<BR>myDSN="DSN=products"<BR>mySQL="select * from products ORDER BY Series, Description"<BR>showblank="&nbsp;"<BR>shownull=""< BR><BR>set conntemp=server.createobject("adodb.connection")<B R>conntemp.open myDSN<BR>set rstemp=conntemp.execute(mySQL)<BR>If rstemp.eof then<BR> response.write "No records matched<BR>"<BR> response.write mySQL & "<BR>So cannot make table..."<BR> conntemp.close<BR> set conntemp=nothing<BR> response.end<BR>end if<BR>%&#062;<BR>&#060;table border=0&#062;&#060;tr&#062;<BR><BR>&#060;% &#039Put Headings On The Table of Field Names<BR>for each whatever in rstemp.fields%&#062;<BR> &#060;td bgcolor="#cccccc"&#062;&#060;b&#062;&#060;font size="-2"&#062;&#060;%=whatever.name%&#062;&#060;/font&#062;&#060;/B&#062;&#060;/TD&#062;<BR>&#060;% next %&#062;<BR>&#060;/tr&#062;<BR><BR>&#060;% &#039 Now lets grab all the records<BR>DO UNTIL rstemp.eof %&#062;<BR> &#060;tr&#062;<BR> &#060;% for each whatever in rstemp.fields<BR> thisfield=whatever.value<BR> if isnull(thisfield) then<BR> thisfield=shownull<BR> end if<BR> if trim(thisfield)="" then<BR> thisfield=showblank<BR> end if%&#062;<BR> &#060;td valign=top bgcolor="#ececdc"&#062;&#060;font size="-2"&#062;&#060;%=thisfield%&#062;&#060;/font&#062;&#060;/td&#062;<BR> &#060;% next %&#062;<BR> &#060;/tr&#062;<BR> &#060;%rstemp.movenext<BR>LOOP%&#062;<BR>&#060;/table&#062;<BR><BR>&#060;%<BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing<BR>%&#062;<BR><BR>thanks very much,<BR>alex

  2. #2
    Arulkumar Guest

    Default RE: Displaying Recordset results as page loads....

    I think u may used this method. Use <BR>&#060;% response.buffer=ture %&#062; at the top of ur asp page<BR><BR>

  3. #3
    Join Date
    Dec 1969
    Posts
    572

    Default RE: Displaying Recordset results as page loads....

    I know that adding &#060;% response.buffer=true %&#062; is part of it. But that only won&#039t do the trick. I even tried it. Apparently &#060;% response.flush %&#062; has to be added later in the page but i&#039m not sure where. How would i modify the following code to do this:<BR><BR>I&#039m using ASP to display an Access table. Unfortunately, it takes long for the entire table to load and i&#039d like the results to be written to the page as the database is read. Can this be accomplished with Access, or just SQL server?<BR><BR>Somebody to me to add &#060;% response.buffer = true %&#062; to the top of the page but i know at some point you must flush the results.... how would i modify the following code to do this?<BR><BR>&#060;% <BR>&#039 ASP program that displays a database in table form<BR>myDSN="DSN=products"<BR>mySQL="select * from products ORDER BY Series, Description"<BR>showblank="&nbsp;"<BR>shownull=""< BR><BR>set conntemp=server.createobject("adodb.connection")<B R>conntemp.open myDSN<BR>set rstemp=conntemp.execute(mySQL)<BR>If rstemp.eof then<BR> response.write "No records matched<BR>"<BR> response.write mySQL & "<BR>So cannot make table..."<BR> conntemp.close<BR> set conntemp=nothing<BR> response.end<BR>end if<BR>%&#062;<BR>&#060;table border=0&#062;&#060;tr&#062;<BR><BR>&#060;% &#039Put Headings On The Table of Field Names<BR>for each whatever in rstemp.fields%&#062;<BR> &#060;td bgcolor="#cccccc"&#062;&#060;b&#062;&#060;font size="-2"&#062;&#060;%=whatever.name%&#062;&#060;/font&#062;&#060;/B&#062;&#060;/TD&#062;<BR>&#060;% next %&#062;<BR>&#060;/tr&#062;<BR><BR>&#060;% &#039 Now lets grab all the records<BR>DO UNTIL rstemp.eof %&#062;<BR> &#060;tr&#062;<BR> &#060;% for each whatever in rstemp.fields<BR> thisfield=whatever.value<BR> if isnull(thisfield) then<BR> thisfield=shownull<BR> end if<BR> if trim(thisfield)="" then<BR> thisfield=showblank<BR> end if%&#062;<BR> &#060;td valign=top bgcolor="#ececdc"&#062;&#060;font size="-2"&#062;&#060;%=thisfield%&#062;&#060;/font&#062;&#060;/td&#062;<BR> <BR> &#060;% next %&#062;<BR> &#060;/tr&#062;<BR> <BR> &#060;%rstemp.movenext<BR>LOOP%&#062;<BR>&#060;/table&#062;<BR><BR>&#060;%<BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing<BR>%&#062;<BR><BR>thanks so much,<BR>alex<BR>

  4. #4
    Sandy Gutheinz Guest

    Default RE: Displaying Recordset results as page loads....

    The browser does not display anything until the &#060;/table&#062; is encountered. If the result set is large, this might take a while until all the data is retrieved.<BR><BR>To solve this, I add a counter inside the do...loop. Whenever the record retrieved reached a certain amount (for example: every 100 records), close the table and recreate another table for the next 100 records.<BR><BR>This method will display 100 records at a time while the next set of records are being retrieved.<BR><BR>- Sandy Gutheinz


  5. #5
    Stephen Fisher Guest

    Default RE: Displaying Recordset results as page loads....

    Sandy is absolutely correct. Also do not use response.buffer = true if you want the page to display data as it is processing. Response.buffer = true buffers the page until completely processed. Response.flush will send all buffered data to the client when it is called.<BR><BR>As Sandy mentioned you need to close the &#060;/table&#062; tag for the browser to render the page. If you use buffering you would also at this time issue response.flush.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •