p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP 3.0 (http://p2p.wrox.com/forumdisplay.php?f=27)
-   -   Chapter 13 - large record set causing error with A (http://p2p.wrox.com/showthread.php?t=14394)

BasilKBL June 18th, 2004 02:52 PM

Chapter 13 - large record set causing error with A
 
Working my way through Wrox Beginning ASP 3.0 to enable review of legacy code. Chapter 13 Using Record sets. Download a file from wrox site movies2000.mdb and create pages to extract record sets. Ran into some problems so eventually I downloaded the asp files from the wrox site these pages had the same problems. Basically, when pulling a record set of movies, and directors which totals 330 rows, the code Moving.ASP returns masses of largely unintelligible gibberish, though it does appear to reading something from ASP, like connection strings etc. If I reduce the recordset to 295 (from 330) eveything works fine, (wrox code and mine). I had a similar problem latterwith the StaffTable.asp where the record set was 1000+ a quick delete (to approx 295 records) and everything works fine. So it does appear to be a problem with the size of the recordset for either IIS, ASP or the browser. My OS is Windows 2000 Professional (IIS5), 512M Ram, IE6, . My Access is Access 2000 but the Wrox file is older than this probably Access97. I didn't convert it but I did open the files for a look see. The tables seem intact. Any suggestions?

Imar June 19th, 2004 04:17 AM

Hi there,

Can you post the code you're using to access the database? And what database are you using? This one: http://web.wrox.com/0764543636/movie2000for97.zip

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Debra by Beck (From the album: Midnite vultures) What's This?

BasilKBL June 19th, 2004 07:07 AM

Database downloaded from http://www.wrox.com/dynamic/books/download.aspx Chapter 12. This has a zipped database which was unzipped to C:\DataStores as per instructions. The code that I am having a problem with is from the Chapter 13 download Moving.asp (and also StaffTable.asp)

Code is below, (I attach a slightly shortened version which does work to prove that the Recordset and connection are established. This does a simple Response.Write objRS.RecordCount (Returns 330 correct) Note: the main listing works perfectly if I reduce the number of records to 295. Perhaps there has been a corruption in the unzipping but I have repeated the download and unzipped and Access seems to handling the tables itself OK.

/HEAD>
<BODY>

<%
  Dim intChosenRecord, strDirection, strOutputString, intCounter, intNoOfRecords
  If Request.Form("ChosenRec") <> "" Then
    intChosenRecord = Request.Form("ChosenRec")
    strDirection = Request.Form("Dir")
  Else
    intChosenRecord = 1
    strDirection = "Forward"
  End If

  Dim objRS
  Set objRS = Server.CreateObject("ADODB.Recordset")
  objRS.Open "AllMovies", strConnect, adOpenStatic, adLockReadOnly, adCmdTable
  intNoOfRecords = objRS.RecordCount
  objRS.Move intChosenRecord-1

  strOutputString = "<TABLE BORDER=1>" & _
                    "<TR><TD WIDTH=""30%""><B>Director</B></TD>" & _
                        "<TD><B>Film<B></TD></TR>"
  If strDirection = "Forward" Then
    While Not objRS.EOF
      strOutputString = strOutputString & "<TR>" & _
        "<TD>&nbsp;" & objRS("TitleID") & ": " & objRS("Director") & "</TD>" & _
        "<TD>" & objRS("Title") & "</TD>" & _
        "</TR>"
      objRS.MoveNext
    Wend
    objRS.MoveFirst
    For intCounter = 1 To intChosenRecord-1
      strOutputString = strOutputString & "<TR>" & _
        "<TD>&nbsp;" & objRS("TitleID") & ": " & objRS("Director") & "</TD>" & _
        "<TD>" & objRS("Title") & "</TD>" & _
        "</TR>"
      objRS.MoveNext
    Next
  Else
    While Not objRS.BOF
      strOutputString = strOutputString & "<TR>" & _
        "<TD>&nbsp;" & objRS("TitleID") & ": " & objRS("Director") & "</TD>" & _
        "<TD>" & objRS("Title") & "</TD>" & _
        "</TR>"
      objRS.MovePrevious
    Wend
    objRS.MoveLast
    For intCounter = intNoOfRecords To intChosenRecord+1 Step -1
      strOutputString = strOutputString & "<TR>" & _
        "<TD>&nbsp;" & objRS("TitleID") & ": " & objRS("Director") & "</TD>" & _
        "<TD>" & objRS("Title") & "</TD>" & _
        "</TR>"
      objRS.MovePrevious
    Next
  End If
  strOutputString = strOutputString & "</TABLE>"
  objRS.Close
  Set objRS = Nothing
  Response.Write strOutputString
%>

<BR>
<FORM ACTION="Moving.asp" METHOD="POST">
  <H2>Format the list!</H2>
  Where do you want ths list to begin? Record
  <SELECT SIZE=1 NAME="ChosenRec">
  <%
    For intCounter=1 To intNoOfRecords
      Response.Write "<OPTION VALUE=" & intCounter & ">" & intCounter & "</OPTION>"
    Next
  %>
  </SELECT><BR><BR>
  Do you want the records to be listed
  in <INPUT TYPE="RADIO" NAME="Dir" VALUE="Forward" CHECKED><B> forward</B></INPUT>
  or <INPUT TYPE="RADIO" NAME="Dir" VALUE="Reverse"> <B>reverse</B></INPUT>
  order (select one)?
  <INPUT TYPE="SUBMIT" VALUE="View the list"></INPUT>
</FORM>
</BODY>
</HTML>
' My shortened version follows next
%
  Option Explicit
  Dim strConnect
%>


<HTML>
<HEAD>
<TITLE>Working your Way round a Recordset</TITLE>
</HEAD>
<BODY>

<%
  Dim intChosenRecord, strDirection, strOutputString, intCounter, intNoOfRecords
  If Request.Form("ChosenRec") <> "" Then
    intChosenRecord = Request.Form("ChosenRec")
    strDirection = Request.Form("Dir")
  Else
    intChosenRecord = 1
    strDirection = "Forward"
  End If

  Dim objRS
  Set objRS = Server.CreateObject("ADODB.Recordset")
  objRS.Open "Select * From AllMovies", strConnect, 3, 1
  intNoOfRecords = objRS.RecordCount
  objRS.Move intChosenRecord-1

  strOutputString = "<TABLE BORDER=1>" & _
                    "<TR><TD WIDTH=""30%""><B>Director</B></TD>" & _
                        "<TD><B>Film<B></TD></TR>"

  strOutputString = strOutputString & "</TABLE>"
    Response.Write "Number of Films :" & objRS.RecordCount 'Delete Table and loop prove mdb open and RS
  objRS.Close
  Set objRS = Nothing
  Response.Write strOutputString
%>

<BR>
<FORM ACTION="Moving.asp" METHOD="POST">
  <H2>Format the list!</H2>
  Where do you want ths list to begin? Record
  <SELECT SIZE=1 NAME="ChosenRec">
  <%
    For intCounter=1 To intNoOfRecords
      Response.Write "<OPTION VALUE=" & intCounter & ">" & intCounter & "</OPTION>"
    Next
  %>
  </SELECT><BR><BR>
  Do you want the records to be listed
  in <INPUT TYPE="RADIO" NAME="Dir" VALUE="Forward" CHECKED><B> forward</B></INPUT>
  or <INPUT TYPE="RADIO" NAME="Dir" VALUE="Reverse"> <B>reverse</B></INPUT>
  order (select one)?
  <INPUT TYPE="SUBMIT" VALUE="View the list"></INPUT>
</FORM>
</BODY>
</HTML>

Imar June 19th, 2004 08:27 AM

This looks like two separate ASP pages to me. Which one is causing the problem? Is the problem reproducible with a file from the code download?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The Outlaw Torn by Metallica (Track 14 from the album: Load) What's This?

BasilKBL June 19th, 2004 09:16 AM

Yes, there are two seperate pages. The firstone is Movies.asp downloaded from Wrox which doesn't work for me. The second is an abridged version where I took out the looping and just did a simple Response.Write. This does work (but obviously only delivers a very limited output "Number of Files = 330") proving that that the Connection and RS are instantiated. So Why doesn't the main page work for me though it does for others?

Imar June 19th, 2004 09:32 AM

Very odd. The page runs fine for me; both with the Access 2000 and the Access 97 database.

What OS are you running this on? Did you install recent ADO drivers?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Don't Cry (Alt. Lyrics) by Guns N' Roses (Track 12 from the album: Use Your Illusion 2) What's This?

BasilKBL June 19th, 2004 04:54 PM

OS is Windows2000 Professional. ADO2.5 is installed as standard. Runing effectively as PWS Today I installed MDAC2.8 (the latest I think). Absolutely no difference. Does it suggest a problem with IIS or some form of memory leakage. As I said the problem is it works fine for a restricted record set. That is 295 records rather than 330. Just to be clear. If I delete 34 records from the AllMovies table everything works fine. Similarly if I reduce the record set from StaffTable to 295 (Just a random choice) it also works. So there appears to be no problem with the code, and no problem with database. So it must be IIS ability to store the information (machine has 512M RAM installed) prior to presenting it as HTML??? Perhaps... But then why does nobody else have this problem

Imar June 20th, 2004 04:57 AM

Hi again,

What do you mean with "Running effectively as PWS"? You did install IIS, right?

Are you having problems with a specific record? That is, does it matter which records you delete? And can you define "masses of largely unintelligible gibberish"? How does your page look like?

Just as with your other issue: this shouldn't happen, but I am stumped as to why it does.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Paisley Park by Prince and the Revolution (Track 2 from the album: Around The World In A Day) What's This?

BasilKBL June 20th, 2004 09:49 AM

Yes, definately IIS 5.0 on local machine, Windows 2000 Professional, IE 6.0.2800. I have also downloaded the files unto my laptop which runs XP Pro, IIS 5.1 IE 6.0.2800 - Everything worked fine - No problems. I copied this database to the local machine - problems return. I then tried to open the files using Opera - Same problem as explorer. So it would appear to be a local machine or IIS 5.0 issue.

I attach the first page of the screen dump to explain the gibberish

HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Sun, 20 Jun 2004 13:40:45 GMT Content-Length: 35032 Content-Type: text/html Cache-control: private RABQT=FGPNNDBCKKLHOLCPOBOLPBNJ; path=/ Cache-control: private COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH Allow: OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK Cache-Control: private ! ,C:\WINNT\system32\inetsrv\asp.dll,1,GET,HEAD,POST ,TRACE.cer,C:\WINNT\system32\inetsrv\asp.dll,1,GET ,HEAD,POST,TRACE.cdx,C:\WINNT\system32\inetsrv\asp .dll,1,GET,HEAD,POST,TRACE.asa,C:\WINNT\system32\i netsrv\asp.dll,1,GET,HEAD,POST,TRACE.htr\system3 ! sr B Ô´lnguage+ d ATQC XñpmtDDèB PñpmGðe ) & xÔ d €8¾´@ Ť€s yÒ ‹× ÜÂú µ M+ ð~µ,C:\WINNT\system32\inetsrv\asp.dll,1GET,HEAD, POST,TRACE.cer,C:\WINNT\system32\inetsrv\asp.dll,1 GET,HEAD,POST,TRACE.cdx,C:\WINNT\system32\inetsrv\ asp.dll,1GET,HEAD,POST,TRACE.asa,C:\WINNT\system32 \inetsrv\asp.dll,1GET,HEAD,POST,TRACE.htr,C:\WINNT \system32\inetsrv\asp.dll,1GET,POST.idc,C:\WINNT\s ystem32\inetsrv\httpodbc.dll,1OPTIONS,GET,HEAD,POS T,PUT,DELETE,TRACE.shtm,C:\WINNT\system32\inetsrv\ ssinc.dll,1GET,POST.shtml,C:\WINNT\system32\inetsr v\ssinc.dll,1GET,POST.stm,C:\WINNT\system32\inetsr v\ssinc.dll,1GET,POST.printer,C:\WINNT\system32\ms w3prt.dll,1GET,POST)M ,C:\WINNT\system32\inetsrv\asp.dll,1,GET,HEAD,POST ,TRACE.cer,C:\WINNT\system32\inetsrv\asp.dll,1,GET ,HEAD,POST,TRACE.cdx,C:\WINNT\system32\inetsrv\asp .dll,1,GET,HEAD,POST,TRACE.asa,C:\WINNT\system32\i netsrv\asp.dll,1,GET,HEAD,POST,TRACE.htr,C:\WINNT\ system32\inetsrv\asp.dll,1,GET,POST.idc ) C:\Inetpub\wwwroot\BegASPFiles\Moving.aspp+ ATQC ˆñpmDÖ´èB €ñpmGðe , ' ¨ €8¾´@ Ť€s yÒ ‹× ÜÂú à µ Æ+ GET/BegASP/StaffTable.aspHTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* Referer: http://joan/BegASP/InteractiveDirectory.asp Accept-Language: en-gb Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; DIL0001021; .NET CLR 1.1.4322) Host: joan Connection: Keep-Alive Cookie: SavedLogin=pw=&email=basil; ASPSESSIONIDQSARABQT=AGPNNDBCENMPMNCIGNDCHHHM HHM Æ :\Inetpub\wwwroot\BegASPFiles\StaffTable.asprt.asp :\WINNT\system32\inetsrv\asp.dll, ÁCa$ ¥ ¥ ¥ ¥ `ï®ÿÿÿÿ ØZ ˜8µ+ *èÿ´" !ˆnµS Q _BKavedLogin=pw=&email=basil Id µ , BegASP/InteractiveDirectory.asp /BEGASP/MOVING.ASPP ˜ B˜ B BegASP/ExpertMoving.asp.aspsp BegASP/ExpertMoving.asp.aspsp BegASP/ExpertMoving.asp.aspsp à µ €BLOB ŸIðe° µ ÿÿÿÿ )PT ØÜ® É 400,*,FILE,C:\WINNT\help\iisHelp\common\400.htm401 ,1,FILE,C:\WINNT\help\iisHelp\common\401-1.htm401,2,FILE,C:\WINNT\help\iisHelp\common\401-2.htm401,3,FILE,C:\WINNT\help\iisHelp\common\401-3.htm401,4,FILE,C:\WINNT\help\iisHelp\common\401-4.htm401,5,FILE,C:\WINNT\help\iisHelp\common\401-5.htm403,1,FILE,C:\WINNT\help\iisHelp\common\403-1.htm403,2,FILE,C:\WINNT\help\iisHelp\common\403-2.htm403,3,FILE,C:\WINNT\help\iisHelp\common\403-3.htm403,4,FILE,C:\WINNT\help\iisHelp\common\403-4.htm403,5,FILE,C:\WINNT\help\iisHelp\common\403-

Imar June 21st, 2004 04:13 AM

Wow, this *is* gibberish..... And indeed it looks like an IIS issue.

Did you try to reinstall IIS? Do you have any blocking software, like URL Scan or firewall software on the Windows 2000 machine?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Something you got by Jimi Hendrix (Track 4 from the album: Purple Haze) What's This?


All times are GMT -4. The time now is 03:38 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.