Google Answers Logo
View Question
 
Q: dllhost.exe maxes cpu to 100% on classic ASP script run. ( No Answer,   8 Comments )
Question  
Subject: dllhost.exe maxes cpu to 100% on classic ASP script run.
Category: Computers > Programming
Asked by: bengali-ga
List Price: $40.00
Posted: 23 Nov 2004 13:24 PST
Expires: 01 Dec 2004 08:04 PST
Question ID: 433043
I have a problem here. I have recently upsized a shop to SQL server.
I am running on a Windows 2003 Server running multiple websites. I
have full access to this server.

The shop works fine and orders are taken into the database after the SQL upsize.
There is one page that is causing major problems.
When this page is brought up, it maxes the CPU to 100% and i can see
dllhost.exe is maxed out (one instance of it)
I have looked thru my code for infinite loops and have debugged and i
know the issue lies somewhere in the code i am posting here. anyone
who can help, i would appreciate it.

Keep in mind that with the access database the page that causes the
CPU to max out runs fine.

========================================================

<%
'THIS PAGE DISPLAYS A CUSTOMER ORDER

'IF THERE IS NO ORDER ID SEND THEM TO THE MAIN ADMIN PAGE
IF Request("txtOrderID") = "" THEN
   Response.Redirect("admin.asp")
END IF

'create recordset to show categories from database
Dim rsOrder, vDesc, sqlOrder, vShipCharge, vShipChargeNote, vOrderTotal
'Set rsOrder = Server.CreateObject ("ADODB.Recordset")


'CREATE THE SQL STATEMENT
sqlOrder = "SELECT orders.OrderID as OrderID, orders.CustID as CustID,
orders.OrderDate as OrderDate, Customers.Phone as Phone,
orders.OrderTax as OrderTax, "_
			& "orders.CCardType as CardType, orders.x_Code as x_Code,
orders.ccardnumber as CardNumber, orders.CCardName as CardName,
orders.CCardExpireDate as CardDate, "_
			& "orders.OrderNote as OrderNote, customers.NameFirst as NameFirst,
customers.NameLast as NameLast, customers.Email as Email, "_
			& "customers.Address1 as Address1, customers.Address2 as Address2,
customers.City as City, "_
			& "customers.State as State, customers.Country as Country,
customers.Zip as Zip, products.Name as ProdName, "_
			& "orderitems.Price as Price, orderitems.QTY as QTY,
[products]![Price]*[orderitems]![QTY]+OrderItems.Shipping AS SubTotal,
"_
			& "orderitems.ProductID as ProdID, OrderItems.Shipping as Shipping,
orders.ShipChargeNote as ShipChargeNote, "_
			& "orders.ShipName as ShipName, orders.ShipAddress1 as
ShipAddress1, orders.ShipAddress2 as ShipAddress2, orders.ShipCity as
ShipCity, "_
			& "orders.ShipCharge as ShipCharge, orders.ShipZip as ShipZip,
orders.ShipState as ShipState, orders.ShipCountry as ShipCountry, "_
			& "orders.OrderTotal as OrderTotal, orders.CCResponseCode as
CCResponseCode, orders.CCResponseReason as CCResponseReason  "_
			& "FROM (categories INNER JOIN products ON categories.CatID =
products.CatID) INNER JOIN ((customers INNER JOIN orders ON
customers.CustID = orders.CustID) INNER JOIN orderitems ON
orders.OrderID = orderitems.OrderID) ON products.ProductID =
orderitems.ProductID "_
			& "WHERE orders.OrderID = "_
			& Request("txtOrderID")

'Response.Write sqlOrder & "<br>" & vbnewline
		
rsOrder.Open sqlOrder, dbc, adOpenForwardOnly,adLockReadOnly

IF NOT rsOrder.EOF THEN

DIM vCardNumber, vCardDate, vCardName, vCardType, vCode, vTax,
vOrderStatus, vOrderStatusReason, vOrderSubtotal, vState

if rsOrder("shipCharge") > "" then
   vShipCharge = rsOrder("ShipCharge")
else
   vShipCharge = 0.00
end if
vShipChargeNote  = rsOrder("ShipChargeNote")
vOrderTotal = rsOrder("OrderTotal")
vTax = rsOrder("OrderTax")

vCardNumber = rsOrder("CardNumber")
vCardDate = rsOrder("CardDate")
vCardName = rsOrder("CardName")
vCardType = rsOrder("CardType")
vCode = rsOrder("x_Code")
vOrderStatus = rsOrder("CCResponseCode")

if isNull(rsOrder("CCResponseReason")) then
  vOrderStatusReason = "none"
else
  vOrderStatusReason = rsOrder("CCResponseReason")
end if

vState = rsOrder("State")
vOrderSubtotal = 0

vDesc=Request("txtItemDesc")
%>
<tr>
	<td colspan=2><br>
<table width=100% align=center border=0 cellspacing=0 cellpadding=0>
      <tr> 
        <td align=left
colspan=2><b><%=UCase(cName)%>&nbsp;INVOICE</b><br> <%=cAddress%><br>
<%=cCSZ%><br> Phone: <%=cPhone%><br> Fax: <%=cFax%><br> </td>
        <td align=right valign=Top colspan=2> <b>ORDER#:
<%=rsOrder("OrderID")%></b><br>
          Customer#: <%=rsOrder("CustID")%><br>
          Order Date: <%=rsOrder("OrderDate")%><br> </td>
      </tr>
      <tr> 
        <td colspan=4>&nbsp;</td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=SILVER></td>
      </tr>
      <tr bgcolor=Silver> 
        <td align=Left nowrap colspan=2> <b>BILLING ADDRESS:</b> </td>
        <td align=Left nowrap colspan=2> <b>SHIPPING ADDRESS:</b> </td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=SILVER></td>
      </tr>
      <tr> 
        <td align=left nowrap><a
href="invoice_billing.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank">BILLING
          INVOICE</a> </td>
        <td align=left>&nbsp;</td>
        <td align=left nowrap><a
href="invoice_shipping.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank">SHIPPING
          INVOICE</a> </td>
        <td align=left>&nbsp;</td>
      </tr>
      <tr> 
        <td align=left nowrap><a
href="label_billing.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank">BILLING
          LABEL</a></td>
        <td align=left>&nbsp;</td>
        <td align=left nowrap><a
href="label_shipping.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank">SHIPPING
          LABEL</a><br> </td>
        <td align=left>&nbsp;</td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Name:&nbsp;&nbsp;</b></td>
        <td align=left
width="40%"><%=ReplaceOut(UCase(rsOrder("NameFirst")))%>&nbsp;&nbsp;<%=ReplaceOut(UCase(rsOrder("NameLast")))%></td>
        <td align=left width="12%" nowrap><b>Name:&nbsp;&nbsp;</b></td>
        <td align=left width="38%"><%=ReplaceOut(UCase(rsOrder("ShipName")))%></td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Company:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><%=ReplaceOut(UCase(rsOrder("Address2")))%></td>
        <td align=left width="12%" nowrap><b>Company:&nbsp;&nbsp;</b></td>
        <td align=left width="38%"><%=UCase(rsOrder("ShipAddress2"))%></td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Address:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><%=ReplaceOut(UCase(rsOrder("Address1")))%></td>
        <td align=left width="12%" nowrap><b>Address:&nbsp;&nbsp;</b></td>
        <td align=left width="38%"><%=UCase(rsOrder("ShipAddress1"))%></td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>CSZ:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><%=UCase(rsOrder("City"))%>,&nbsp;
		<% if Ucase(rsOrder("State")) <> "NONE" then %>
		  <%=UCase(rsOrder("State"))%>&nbsp;
		<% end if %>
		<%=UCase(rsOrder("Zip"))%></td>
        <td align=left width="12%" nowrap><b>CSZ:&nbsp;&nbsp;</b></td>
        <td align=left width="38%"><%=UCase(rsOrder("ShipCity"))%>,&nbsp;
		<% if Ucase(rsOrder("ShipState")) <> "NONE" then %>
		  <%=UCase(rsOrder("ShipState"))%>&nbsp;
		<% end if %>
		<%=UCase(rsOrder("ShipZip"))%></td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Country:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><%=UCase(rsOrder("Country"))%></td>
        <td align=left width="12%" nowrap><b>Country:&nbsp;&nbsp;</b></td>
        <td align=left width="38%"><%=UCase(rsOrder("ShipCountry"))%></td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Email:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><a
href="mailto:<%=rsOrder("Email")%>"><%=rsOrder("Email")%></a></td>
        <td align=left width="12%" nowrap><a
href="label_shipping.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank"><br>
          </a></td>
        <td align=left width="38%">&nbsp;</td>
      </tr>
      <tr> 
        <td align=left width="10%" nowrap><b>Phone:&nbsp;&nbsp;</b></td>
        <td align=left width="40%"><%= rsOrder("Phone") %></td>
        <td align=left width="12%" nowrap><a
href="label_shipping.asp?txtOrderID=<%=rsOrder("OrderID")%>"
target="_blank"><br>
          </a></td>
        <td align=left width="38%">&nbsp;</td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr> 
        <td colspan=4> <table border=0 cellpadding=0 cellspacing=0 width=100%>
            <tr bgcolor=Silver> 
              <td align=left><b>Qty&nbsp;&nbsp;</b></td>
              <td align=left><b>Item&nbsp;&nbsp;</b></td>
              <td align=right><b>Each&nbsp;&nbsp;</b></td>
              <td align=right><b>Shipping&nbsp;&nbsp;</b></td>
              <td align=right><b>SubTotal&nbsp;&nbsp;</b></td>
            </tr>
            <%
'LOOP THROUGH THE ITEMS IN THIS ORDER
rsOrder.MoveFirst

While Not rsOrder.EOF
vOption = "&nbsp;"
vOptionPrice = "0.00"

'CREATE RECORDSET TO SHOW ORDER ITEM OPTIONS
Dim rsItemOptions, sqlItemOptions, vOption, vOptionPrice, vOptionPriceSum
Set rsItemOptions = Server.CreateObject ("ADODB.Recordset")

sqlItemOptions = "SELECT OrderItems.ProductID,
ProductOptions.OptionName, ProductOptionItems.ItemDesc,
OrderItemOptions.OptionItemPrice  "
sqlItemOptions = sqlItemOptions & " FROM ProductOptions INNER JOIN
(ProductOptionItems INNER JOIN (OrderItems INNER JOIN OrderItemOptions
ON OrderItems.ItemID = OrderItemOptions.ItemID) ON
ProductOptionItems.OptionItemID = OrderItemOptions.OptionItemID) ON
ProductOptions.OptionID = ProductOptionItems.OptionID "
sqlItemOptions = sqlItemOptions & " WHERE OrderItems.OrderID = "
sqlItemOptions = sqlItemOptions & rsOrder("OrderID")
sqlItemOptions = sqlItemOptions & " AND OrderItems.ProductID = "
sqlItemOptions = sqlItemOptions & rsOrder("ProdID")
sqlItemOptions = sqlItemOptions & ";"

rsItemOptions.Open sqlItemOptions, dbc, adOpenForwardOnly,adLockReadOnly

IF NOT rsItemOptions.EOF THEN
  rsItemOptions.MoveFirst
  While Not rsItemOptions.EOF
    vOptionPrice = vOptionPrice + rsItemOptions("OptionItemPrice")
    rsItemOptions.MoveNext
  Wend
  rsItemOptions.MoveFirst
END IF
%>
            <tr valign="middle"> 
              <td colspan=5><hr width=100% size=1 noshade color=silver></td>
            </tr>
            <tr valign="middle"> 
              <td align=left><%=rsOrder("QTY")%>&nbsp;</td>
              <td align=left><%=ReplaceOut(rsOrder("ProdName"))%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber(rsOrder("Price") + vOptionPrice,2)%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber(rsOrder("Shipping"),2)%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber((rsOrder("Price") +
vOptionPrice)*rsOrder("QTY")+rsOrder("Shipping"),2)%>&nbsp;</td>
              <%
			  ' Capture the Item and Order subtotals for use later.
			  
			  dim vItemSubtotal
			  
			  vItemSubtotal = (rsOrder("Price") + vOptionPrice) *
rsOrder("QTY") + rsOrder("Shipping")
			  
			  vOrderSubtotal = vOrderSubtotal + vItemSubtotal
			  %>
            </tr>
            <%'THIS IS WHERE WE WRITE THE OPTIONS IF THERE ARE ANY%>
            <tr> 
              <td align=left>&nbsp;</td>
              <td align=left><font size=1> 
                <%
		IF NOT rsItemOptions.EOF THEN
		rsItemOptions.MoveFirst
		While Not rsItemOptions.EOF

		Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;" &
ReplaceOut(rsItemOptions("OptionName")) & ":&nbsp;" &
ReplaceOut(rsItemOptions("ItemDesc")) & " Add: &nbsp;" &
cCurrencyFormat & FormatNumber(rsItemOptions("OptionItemPrice"),2) &
"<br>")

		'GO GET THE NEXT ITEM OPTION
		rsItemOptions.MoveNext

		Wend
		'rsItemOptions.Close
		END IF
		%>
                &nbsp;</font></td>
              <td align=right>&nbsp;</td>
              <td align=right>&nbsp;</td>
              <td align=right>&nbsp;</td>
            </tr>
            <%
'KEEP A RUNNING 
vOptionPriceSum = vOptionPriceSum + vOptionPrice
'GO GET THE NEXT ITEM
rsOrder.MoveNext
Wend
%>
          </table>
          <%
		  'Store the previously calculated OrderSubtotal in the Session
		  Session("OrderSubtotal") = FormatNumber(vOrderSubtotal, 2)
		  %> </td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr bgcolor=Silver> 
        <td colspan=4>&nbsp;</td>
      </tr>
      <form method=POST
action="order_report.asp?mode=adjust&txtOrderID=<%=Request("txtOrderID")%>">
        <%
		IF Request("txtOrderID")<>"" AND Request("mode")="adjust" THEN
		Dim sqlOrderStatAdjust, vAdjMsg
				
		sqlOrderStatAdjust = "UPDATE Orders SET ShipCharge = '" &
Request.Form("ShipCharge") _
		   & "', ShipChargeNote = '" & Request.Form("ShipChargeNote") _
		   & "', OrderTotal = '" & FormatNumber(Session("OrderSubtotal") -
Request.Form("ShipCharge") + ((Session("OrderSubtotal") -
Request.Form("ShipCharge")) * Session("TaxRate")), 2) _
		   & "', OrderTax = '" & FormatNumber((Session("OrderSubtotal") -
Request.Form("ShipCharge")) * Session("TaxRate"), 2) _
		   & "' WHERE OrderID = " & Request("txtOrderID") & ";"
		
		ON ERROR RESUME NEXT
		
		dbc.execute(sqlOrderStatAdjust)
			IF ERR.number <> 0 THEN
			   vAdjMsg = Err.Description
			ELSE
			   vAdjMsg = "Updated Successfully"
			   vShipCharge = Request.Form("ShipCharge")
			   vShipChargeNote = Request.Form("ShipChargeNote")
			END IF
		END IF
        %>
        <tr> 
          <td align=left colspan=2> Change Adjustment:&nbsp;&nbsp; <%
If vShipCharge > 1 Then %> <input name="ShipCharge" type="text"
id="ShipCharge" value="<%= FormatNumber(vShipCharge, 2) %>">
            <% Else %> <input name="ShipCharge" type="text"
id="ShipCharge" value="0.00">
            <% End If %> &nbsp;&nbsp;&nbsp;</td>
          <td width="12%" align=right valign="top" nowrap>Current
Adjustment:&nbsp;</td>
          <td align=right valign="top">- 
            <%
		if vShipCharge > 1 then
		   Response.Write(cCurrencyFormat & FormatNumber(vShipCharge,2)) 
		else
		   Response.Write(cCurrencyFormat & "0.00") 
		end if %></td>
        </tr>
        <tr> 
          <td colspan="2" align=left>Change Note:&nbsp;&nbsp; <input
name="ShipChargeNote" type="text" id="ShipChargeNote" value="<%=
vShipChargeNote %>" size="50" maxlength="50">
            &nbsp;&nbsp;&nbsp;</td>
          <td align=right valign="top">Adjustment Note:&nbsp;</td>
          <td align="right" valign="top"> <% if Len(vShipChargeNote) >
1 then %> <%= vShipChargeNote %> <% else %> <i>&lt;none&gt;</i> <% end
if %> </td>
          <%' v 5.5 %>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td align="right"></td>
          <td align="right" valign="bottom">Sub Total:&nbsp;</td>
          <td align="right" valign="bottom"><% vOrderSubtotal =
vOrderSubtotal - vShipCharge %> <%= cCurrencyFormat &
FormatNumber(vOrderSubtotal, 2) %></td>
        </tr>
        <tr> 
          <td colspan="2" align=right>&nbsp;</td>
          <td width="12%" align=right valign="bottom">Tax:&nbsp;</td>
          <%' v 5.5 %>
          <td align=right valign="bottom"> <%
          'GRAB THE TAX RATE IF THERE IS ONE
          DIM sqlTax, rsTax, vTaxRate

          'CREATE A RECORDSET
          SET rsTax = Server.CreateObject ("adodb.Recordset")

          'sqlTax="SELECT * FROM TAX WHERE STATE = '" & vState & "'
AND ActiveIndicator = 'Y';"
          sqlTax="SELECT * FROM TAX WHERE STATE = '" & vState & "' AND
ActiveIndicator = 'Y';"

          rsTax.Open sqlTax, dbc, adOpenForwardOnly, adLockReadOnly
	
          IF NOT rsTax.EOF THEN
            vTaxRate = rsTax("rate") / 100
          ELSE 
            vTaxRate = 0
          END IF
		  
		  ' Store the tax rate in the session
		  Session("TaxRate") = vTaxRate
		  
		  rsTax.Close
		  
		  vTax = vTaxRate * vOrderSubtotal
		  vTax = Round(vTax, 2)
		  'vOrderTotal = vOrderSubtotal + vTax
		  
		  Response.Write cCurrencyFormat & FormatNumber(vTax, 2)
		  %></td>
        </tr>
        <tr> 
          <td align=left>&nbsp;</td>
          <td align=right>&nbsp;</td>
          <td width="12%" align=right valign="bottom">Total:&nbsp;</td>
          <td align=right valign="bottom"> <% vOrderTotal =
vOrderSubtotal + vTax %> <%=cCurrencyFormat &
FormatNumber(vOrderTotal,2)%></td>
        </tr>
        <tr> 
          <td align=right colspan=4><font
color=GREEN><b>&nbsp;<%=vAdjMsg%></b></font></td>
        </tr>
        <tr align="right"> 
          <td colspan=4> <input type=SUBMIT value="Update" name=btnSubmit> &nbsp; 
            <input type=RESET value="Reset" name=btnReset></td>
        </tr>
      </form>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr bgcolor=Silver> 
        <td colspan=4><b>Payment Details</b></td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr> 
        <td align=left>&nbsp;</td>
        <td align=left>&nbsp;</td>
        <td align=right nowrap>Card Type:&nbsp;</td>
        <td align=right><%=vCardType%>&nbsp;</td>
      </tr>
      <tr> 
        <td align=left>&nbsp;</td>
        <td align=left>&nbsp;</td>
        <td align=right nowrap>Card Name:&nbsp;</td>
        <td align=right><%=ReplaceOut(vCardName)%>&nbsp;</td>
      </tr>
      <tr> 
        <td align=left>&nbsp;</td>
        <td align=left>&nbsp;</td>
        <td align=right nowrap>Card Number:&nbsp;</td>
        <td align=right><%=DecryptIt(vCardNumber)%>&nbsp;</td>
      </tr>
      <tr> 
        <td align=left>&nbsp;</td>
        <td align=left>&nbsp;</td>
        <td align=right nowrap>Card Date:&nbsp;</td>
        <td align=right><%=vCardDate%>&nbsp;</td>
      </tr>
      <tr> 
        <td height="16" align=left>&nbsp;</td>
        <td align=left>&nbsp;</td>
        <td align=right nowrap>Access Code:</td>
        <td align=right><%=vCode%>&nbsp;</td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr bgcolor=Silver> 
        <td colspan=4><b>Payment Status</b></td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <form method=POST
action="order_report.asp?mode=update&txtOrderID=<%=Request("txtOrderID")%>">
        <tr> 
          <td align=left nowrap>Status:&nbsp;</td>
          <%'IF THERE IS NO CCRESPONSECODE OR IF THE CCRESPONSECODE=1
THEN THE ORDER HAS BEEN APPROVED.  ELSE DECLINED%>
          <td colspan=3 align=right><select name="selOrderStat">
              <%
		IF Request("txtOrderID")<>"" AND Request("mode")="update" THEN
		Dim sqlOrderStatUpdate, vUpdMsg
		sqlOrderStatUpdate = "UPDATE ORDERS SET CCResponseCode = '"
		sqlOrderStatUpdate = sqlOrderStatUpdate & Request.Form("selOrderStat")
		sqlOrderStatUpdate = sqlOrderStatUpdate & "', CCResponseReason = '"
		sqlOrderStatUpdate = sqlOrderStatUpdate & Request.Form("txtStatusDesc")
		sqlOrderStatUpdate = sqlOrderStatUpdate & "' WHERE ORDERID="
		sqlOrderStatUpdate = sqlOrderStatUpdate & Request("txtOrderID")
		sqlOrderStatUpdate = sqlOrderStatUpdate & ";"
		ON ERROR RESUME NEXT
		dbc.execute(sqlOrderStatUpdate)
			IF ERR.number <> 0 THEN
			vUpdMsg = Err.Description
			ELSE
			vUpdMsg = "Updated Successfully"
			vOrderStatus = Request.Form("selOrderStat")
			vOrderStatusReason = Request.Form("txtStatusDesc")
			END IF
		END IF
				
		Dim rsOrderStat, sqlOrderStat
		Set rsOrderStat = Server.CreateObject ("ADODB.Recordset")

		sqlOrderStat = "SELECT * FROM ORDERSTATUS WHERE ORDERSTATUSINDICATOR = 'Y';"

		rsOrderStat.Open sqlOrderStat, dbc, adOpenForwardOnly,adLockReadOnly

		IF NOT rsOrderStat.EOF THEN
		While Not rsOrderStat.EOF
			IF rsOrderStat("ORDERSTATUSCODE")=vOrderStatus THEN
			Response.Write("<OPTION VALUE=" & rsOrderStat("ORDERSTATUSCODE") &
" SELECTED >" & rsOrderStat("ORDERSTATUSNAME") )
			ELSE
			Response.Write("<OPTION VALUE=" & rsOrderStat("ORDERSTATUSCODE") &
">" & rsOrderStat("ORDERSTATUSNAME") )
			END IF
		rsOrderStat.MoveNext
		WEND
		rsOrderStat.Close
		
		ELSE
		Response.Write("<OPTION VALUE=''>None Found")
		END IF
		
		%>
            </select></td>
        </tr>
        <tr> 
          <td align=left nowrap>Status Description:&nbsp;</td>
          <td colspan=3 align=right> <input name="txtStatusDesc"
type=TEXT value="<%=vOrderStatusReason%>" size=50 maxlength="50"></td>
        </tr>
        <tr> 
          <td align=right colspan=4><font
color=GREEN><b><%=vUpdMsg%></b></font>&nbsp;</td>
        </tr>
        <tr> 
          <td align=right nowrap>&nbsp;</td>
          <td colspan=3 align=right> <input type=SUBMIT value="Update"
name=btnSubmit>
            &nbsp; <input type=RESET value="Reset" name=btnReset></td>
        </tr>
      </form>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <tr bgcolor=Silver> 
        <td colspan=4><b>Questions, Comments, Additional Instructions (Customers 
          See These):</b></td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <form  method=POST
action="order_report.asp?mode=Comment&txtOrderID=<%=Request("txtOrderID")%>">
        <tr> 
          <td colspan=4 align="center" valign="middle"> <%
		dim rsOrderComment, sqlOrderComment, vOrderComment, vCommentMsg
		
		if Request.QueryString("txtOrderID")  <> "" and
Request.QueryString("mode") = "Comment" then
		   sqlOrderComment = "UPDATE Orders SET OrderComment = '" &
Request.Form("OrderComment") & "' WHERE OrderID = " &
Request.QueryString("txtOrderID") & ";"
		   
		   ON ERROR RESUME NEXT
		   dbc.execute(sqlOrderComment)
		   IF ERR.number <> 0 THEN
			  vCommentMsg = Err.Description
		   ELSE
			  vCommentMsg = "Updated Successfully"
		   END IF
		END IF
		
		Set rsOrderComment = Server.CreateObject ("ADODB.Recordset")
		
		sqlOrderComment = "SELECT * FROM Orders WHERE OrderID = " &
Request.QueryString("txtOrderID") & ";"
		rsOrderComment.Open sqlOrderComment, dbc, adOpenForwardOnly, adLockReadOnly
		
		vOrderComment = rsOrderComment("OrderComment")
		%> <textarea name="OrderComment" cols="50" rows="10"><%=
vOrderComment %></textarea>
            <% rsOrderComment.Close %> </td>
        </tr>
        <tr align="center"> 
          <td colspan=4><font color=GREEN><b><%=vCommentMsg%></b></font>&nbsp;</td>
        </tr>
        <tr align="center"> 
          <td colspan=4> <input type=SUBMIT value="Update" name=btnSubmit> &nbsp; 
            <input type=RESET value="Reset" name=btnReset></td>
        </tr>
      </form>
      <tr> 
        <td colspan=4>&nbsp;</td>
      </tr>
      <tr bgcolor=Silver> 
        <td colspan=4><b>Administrative Comments (Customers Do Not See
These):</b></td>
      </tr>
      <tr> 
        <td colspan=4><hr width=100% size=1 noshade color=silver></td>
      </tr>
      <form  method=POST
action="order_report.asp?mode=note&txtOrderID=<%=Request("txtOrderID")%>">
        <tr> 
          <td colspan=4 align="center" valign="middle"> <%
		dim rsOrderNote, sqlOrderNote, vOrderNote, vNoteMsg
		
		if Request.QueryString("txtOrderID")  <> "" and
Request.QueryString("mode") = "note" then
		   sqlOrderNote = "UPDATE Orders SET OrderNote = '" &
Request.Form("OrderNote") & "' WHERE OrderID = " &
Request.QueryString("txtOrderID") & ";"
		   
		   ON ERROR RESUME NEXT
		   dbc.execute(sqlOrderNote)
		   IF ERR.number <> 0 THEN
			  vNoteMsg = Err.Description
		   ELSE
			  vNoteMsg = "Updated Successfully"
		   END IF
		END IF
		
		Set rsOrderNote = Server.CreateObject ("ADODB.Recordset")
		
		sqlOrderNote = "SELECT * FROM Orders WHERE OrderID = " &
Request.QueryString("txtOrderID") & ";"
		rsOrderNote.Open sqlOrderNote, dbc, adOpenForwardOnly, adLockReadOnly
		
		vOrderNote = rsOrderNote("OrderNote")
		%> <textarea name="OrderNote" cols="50" rows="10"><%= vOrderNote %></textarea> 
            <% rsOrderNote.Close %> </td>
        </tr>
        <tr align="center"> 
          <td colspan=4><font color=GREEN><b><%=vNoteMsg%></b></font>&nbsp;</td>
        </tr>
        <tr align="center"> 
          <td colspan=4> <input type=SUBMIT value="Update" name=btnSubmit> &nbsp; 
            <input type=RESET value="Reset" name=btnReset></td>
        </tr>
        <tr></tr>
      </form>
    </table>
</td>
</tr>
<%=ReplaceOut(UCase(rsOrder("ShipName")))%><br>
<br>
<%
ELSE
'WE DID NOT FIND ANYTHING
%>
<tr>
	<td colspan=2>
	<font color=red>
	No Records Found.
	</font>
	</td>
</tr>
<%END IF%>

Clarification of Question by bengali-ga on 24 Nov 2004 10:35 PST
I have narrowed the CPU max leak/bug to somewhere in the following code.
Thanks!  


 <%
'LOOP THROUGH THE ITEMS IN THIS ORDER
rsOrder.MoveFirst

While Not rsOrder.EOF
vOption = "&nbsp;"
vOptionPrice = "0.00"

'CREATE RECORDSET TO SHOW ORDER ITEM OPTIONS
Dim rsItemOptions, sqlItemOptions, vOption, vOptionPrice, vOptionPriceSum
Set rsItemOptions = Server.CreateObject ("ADODB.Recordset")

sqlItemOptions = "SELECT OrderItems.ProductID,
ProductOptions.OptionName, ProductOptionItems.ItemDesc,
OrderItemOptions.OptionItemPrice  "
sqlItemOptions = sqlItemOptions & " FROM ProductOptions INNER JOIN
(ProductOptionItems INNER JOIN (OrderItems INNER JOIN OrderItemOptions
ON OrderItems.ItemID = OrderItemOptions.ItemID) ON
ProductOptionItems.OptionItemID = OrderItemOptions.OptionItemID) ON
ProductOptions.OptionID = ProductOptionItems.OptionID "
sqlItemOptions = sqlItemOptions & " WHERE OrderItems.OrderID = "
sqlItemOptions = sqlItemOptions & rsOrder("OrderID")
sqlItemOptions = sqlItemOptions & " AND OrderItems.ProductID = "
sqlItemOptions = sqlItemOptions & rsOrder("ProdID")
sqlItemOptions = sqlItemOptions & ";"

rsItemOptions.Open sqlItemOptions, dbc, adOpenForwardOnly,adLockReadOnly

IF NOT rsItemOptions.EOF THEN
  rsItemOptions.MoveFirst
  While Not rsItemOptions.EOF
    vOptionPrice = vOptionPrice + rsItemOptions("OptionItemPrice")
    rsItemOptions.MoveNext
  Wend
  rsItemOptions.MoveFirst
END IF
%>
            <tr valign="middle"> 
              <td colspan=5><hr width=100% size=1 noshade color=silver></td>
            </tr>
            <tr valign="middle"> 
              <td align=left><%=rsOrder("QTY")%>&nbsp;</td>
              <td align=left><%=ReplaceOut(rsOrder("ProdName"))%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber(rsOrder("Price") + vOptionPrice,2)%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber(rsOrder("Shipping"),2)%>&nbsp;</td>
              <td align=right><%=cCurrencyFormat &
FormatNumber((rsOrder("Price") +
vOptionPrice)*rsOrder("QTY")+rsOrder("Shipping"),2)%>&nbsp;</td>
              <%
			  ' Capture the Item and Order subtotals for use later.
			  
			  dim vItemSubtotal
			  
			  vItemSubtotal = (rsOrder("Price") + vOptionPrice) *
rsOrder("QTY") + rsOrder("Shipping")
			  
			  vOrderSubtotal = vOrderSubtotal + vItemSubtotal
			  %>
            </tr>
            <%'THIS IS WHERE WE WRITE THE OPTIONS IF THERE ARE ANY%>
            <tr> 
              <td align=left>&nbsp;</td>
              <td align=left><font size=1> 
                <%
		IF NOT rsItemOptions.EOF THEN
		rsItemOptions.MoveFirst
		While Not rsItemOptions.EOF

		Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;" &
ReplaceOut(rsItemOptions("OptionName")) & ":&nbsp;" &
ReplaceOut(rsItemOptions("ItemDesc")) & " Add: &nbsp;" &
cCurrencyFormat & FormatNumber(rsItemOptions("OptionItemPrice"),2) &
"<br>")

		'GO GET THE NEXT ITEM OPTION
		rsItemOptions.MoveNext

		Wend
		'rsItemOptions.Close
		END IF
		%>
                &nbsp;</font></td>
              <td align=right>&nbsp;</td>
              <td align=right>&nbsp;</td>
              <td align=right>&nbsp;</td>
            </tr>
            <%
'KEEP A RUNNING 
vOptionPriceSum = vOptionPriceSum + vOptionPrice
'GO GET THE NEXT ITEM
rsOrder.MoveNext
Wend
%>

Clarification of Question by bengali-ga on 27 Nov 2004 14:53 PST
i dont access to query analyzer.
the values for these are integer values

Request for Question Clarification by mathtalk-ga on 28 Nov 2004 16:47 PST
Hi, bengali-ga:

Are you able to connect to the SQL Server database through Access?  If
so, you could submit the SQL query that way.

Otherwise I suggest you contact the database administrator for the SQL
Server database and ask for help with installing MS Query Analyzer. 
You will need an account (user login/password) in SQL Server or
perhaps to have your Windows network login "authenticated" to SQL
Server in order to execute database queries.

regards, mathtalk-ga
Answer  
There is no answer at this time.

Comments  
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: mathtalk-ga on 23 Nov 2004 14:49 PST
 
I'd certainly try to narrow down the cause a bit.

My attention was drawn, given the context of an Access to SQL Server
conversion, to this line:

rsOrderComment.Open sqlOrderComment, dbc, adOpenForwardOnly, adLockReadOnly

A bit of research is required, but if the ADO implementation of this
involves a "server side" cursor, the client may be doing a lot of
polling; that could explain the CPU maxout.

regards, mathtalk-ga
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: bengali-ga on 23 Nov 2004 16:30 PST
 
all i can say is its in one of these sql queries on this page here.
basically i figure if someone can find a bug in a half hour then $40
was worth their time if they can actually get to the root of the
matter.

the line u are referring to, how would you write it?

i hope someone can take this further.
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: mathtalk-ga on 23 Nov 2004 19:31 PST
 
My suggestion is a "divide and conquer" approach.

Just as  you've narrowed the focus to this one ASP page, the next step
is to comment out roughly the last half of the ASP code in the page
and see if the problem is still present.  If so the bug is in the
first half of the code; if not, then probably in the last half (or at
least it's something that comes to fruition there).

I count six "Open" commands on RecordSet objects.  Strangely, for the
first instance of these, you seem to have commented out the object
creation statement:

'Set rsOrder = Server.CreateObject ("ADODB.Recordset")

Was this intentional?

regards, mathtalk-ga
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: bengali-ga on 24 Nov 2004 11:58 PST
 
no this wasnt intentional but i have narrowed the bad code down to the
post above. help is much appreciated!
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: mathtalk-ga on 24 Nov 2004 12:35 PST
 
Okay, that's good progress!  Next I'd take the SQL query (the one with
all the inner joins) and run it from an ISQL command line (or in MS
Query Analyzer, the "GUI" version) and see how this query runs by
itself.

It's conceivable that in the process of "upsizing" the database, a
crucial index was missed, and that the database is now choking on a
task that formerly it could easily handle.

You'll need to manually supply the "parameters" @OrderID and @ProdID
as shown in this rewritten version of the query:

SELECT OrderItems.ProductID,
       ProductOptions.OptionName,
       ProductOptionItems.ItemDesc,
       OrderItemOptions.OptionItemPrice
FROM ProductOptions INNER JOIN
       ( ProductOptionItems INNER JOIN
         ( OrderItems INNER JOIN OrderItemOptions
         ON OrderItems.ItemID = OrderItemOptions.ItemID)
       ON ProductOptionItems.OptionItemID = OrderItemOptions.OptionItemID)
     ON ProductOptions.OptionID = ProductOptionItems.OptionID
WHERE OrderItems.OrderID   = @OrderID
AND   OrderItems.ProductID = @ProdID

regards, mathtalk-ga
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: bengali-ga on 26 Nov 2004 11:29 PST
 
can i replace that sql query exactly with what you have their at the bottom. 
not sure what u mean by manually supplying the parameters.

im still throwing some errors. just wanna get it working 100% before i
close the question. appreciate your continued help!
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: mathtalk-ga on 26 Nov 2004 16:42 PST
 
What I'm suggesting is that you use Microsoft's Query Analyzer
tool/application to run a query similar to what is being executed by
ASP.  An alternative "command line" interface to a SQL Server database
is ISQL.EXE.

Let me know if you don't have access to one of these programs, or if
you don't know how to connect to the same SQL Server database as you
are using for the Web app.

You will need to pick values for the two parameters.  Basically you
are specifying a value of OrderID and ProductID equivalent to the way
a Web user would be asked to do.  The way I abbreviated these
parameters (@OrderID and @ProdID) is not important, because what I'm
suggesting is that you replace these with actual values.  I can't tell
from your code whether these columns are text values or integer
values; check the definition of table OrderItems if need to.  Integer
values can be given in the usual way (digits), but text should be
inclosed in single quotes.

regards, mathtalk-ga

P.S.  If you close the Question before anyone posts an Answer, you
will not be charged for it (and no one will be paid).  I've been
assisting you through a string of Comments because in this case a
series of refinements is necessary to find the "bug".
Subject: Re: dllhost.exe maxes cpu to 100% on classic ASP script run.
From: bengali-ga on 01 Dec 2004 08:04 PST
 
i ended up finding the answer myself and it was a combination of problems.
the cpu max was caused because sql server requires the ^ operator
instead of the ! operator and the dllhost.exe was showing because i
was in IIS 5 forced mode in High Isolation mode but since all
application pools were default and custom application pools cannot be
created in IIS 5.0 forced mode, errors were being throw which caused
COM surrogate crashes.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy