PDA

View Full Version : Record Set Portability Problem?? Comments appreciated


Dave
07-01-2003, 04:10 PM
When processing a record set the system hangs: Dllhost using all system resources (memory) / CPU at 100%

Background
Upon executing the code below my system hangs. This exact code is executed on our web server and works fine. Microsoft script debugger points to the While Not RS.EOF/WEND loop (in lines of code below) as the problem.

-This problem is occurring in a test system I created to mirror the production web server. I created this system by copying our 50+ ASP’s from our production server to my PC.
-Most ASP’s work fine and are able to access SQL data and process record sets without incident in my test system.
-I cut and pasted the SQL query into SQL Query Analyzer - it worked. I cut the table size down and still have the problem.
-I took the “guts” out of the While not/MoveNext/WEND loop and still experience 100% CPU utilization but the memory problem was not apparent.
-I changed Session("ConnectionTimeout") = 120, Session("CommandTimeout") =120 and Server.ScriptTimeout = 120 with no luck.
-By viewing the source code on the production server I see approximately 3500 records returned to populate a dropdown box. A sampling:
<OPTION value="426">1190 ADAMS LANE, INC
<OPTION value="427">3 STAR BLDRS
<OPTION value="2912">ZCHIESCHE, WILL H.
<OPTION value="2913">ZENO, AUDRY
<OPTION value="3086">ZJC PROPS., INC.
<OPTION value="4731">ZMOLIK
<OPTION value="3497">ZZ INDIVIDUAL
I can cut and paste the returned 3500+ records from production into the ASP, overlaying the while not/WEND statement and it runs it works fine.
-My PC runs on Windows 2000. This script also encounters the same error on our office server that is running on Windows Server 2000 (Same operating system as the production server).

-It seems as if the “EOF” in the record set is not being found and is creating an infinite loop – BUT WHY???

<TR>
<TD width="210"><B>Select Builder Name : (Required)</B></TD>
<TD width="370"><SELECT name="Builder_Code" width="400">
<OPTION value=””>
<% SQL="SELECT A.Builder_Name, A.Builder_Code FROM Tbl_Builders AS A ORDER BY A.Builder_Name"%>
<% Set RS=testoperConn.Execute(SQL) %>
<% While Not RS.EOF %>
<OPTION value="<% = RS("Builder_Code") %>"><%=RS("Builder_Name")%>
<% RS.MoveNext
WEND
RS.Close
Set RS=Nothing
%>
</SELECT>
</TD>

Dave
07-01-2003, 05:33 PM
I discovered a fix but don't fully understand why. In my test system I had changed the connection and ODBC info.

Originally I had the following code in the top of the problem test ASP:

Set testoperConn=Server.CreateObject("ADODB.Connection")
Session("ConnectionString")= "DSN=testoper;UID=testoper;PWD=test;DATABASE=testoper;APP=ASP script"
Session("ConnectionTimeout") = 15
Session("CommandTimeout") = 30

I now relealize that since the Session variables are set in global.asa I don't need to reset them again. Seems if you reset them too often they can bite you.

I changed the code above to the following below in several ASP's and everything works now instead of hanging up:

Set testoperConn=Server.CreateObject("ADODB.Connection")
Set testoperConn=Server.CreateObject("ADODB.Connection")
testoperConn.Open Session("ConnectionString")