p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: about error message "too many client tasks"


Message #1 by "Daniel Walker" <danielw@w...> on Fri, 7 Jul 2000 12:47:25
Dear daniel,



I got a problem when I was updating records (Access NT) for more than 20

records using SQL. The error message was "too many client tasks". After 

the

error message appeared, I must restart my computer to return everything to

normal.



The following is my asp code.



<%response.buffer=true

'---------------------------------------------------------------------------

--------------------------------------------------------------------

cn = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\dgsdata\dgs.mdb"

'---------------------------------------------------------------------------

--------------------------------------------------------------------

%>

<!--#include file="../dgs_config.inc"-->

<!--#include virtual="/includes/adovbs.inc" -->

<html>

<head>

<meta http-equiv=refresh content="1200; URL=dgs_ulogout.asp">

<title>dgs_uform2.asp</title>

</head>

<body bgcolor="white">

<table width="95%" border="0">

  <tr>

    <td width="88%">

<center>

  <h2><%=title%> </h2><br> 

  <b>Requisition for Chemicals in DGS</b>

  </center></td>

    <td width="12%">

      <div align="center">Jobno<br>

	<%=session("dept_code")& session("job_no")%></div>

    </td>

  </tr>

</table>

<center><hr color="#800000" size="5"></center>



<%

if session("marker")="login" then



sqln="select item_no,co_quan,req_quan from ncheck where user_login='" &

session("applicant") & "' and acname='" & session("tacname") & "'"

Set rsn = Server.CreateObject ("ADODB.Recordset")

rsn.open sqln, cn

do until rsn.eof

	selitem=rsn("item_no")

	check_quan=rsn("co_quan")

	

	sqls="select sc_l1,sc_l2,scl1_quan,scl2_quan from chem_info where item_no

='"& selitem &"'"

	Set rss = Server.CreateObject ("ADODB.Recordset")

	rss.open sqls, cn

	sc_l1=rss("sc_l1")

	sc_l2=rss("sc_l2")

	scl1_quan=rss("scl1_quan")

	scl2_quan=rss("scl2_quan")

	tquan=scl1_quan + scl2_quan



	if scl1_quan >= check_quan then

	newquan=scl1_quan - check_quan

	sqlup="update chem_info set scl1_quan="& newquan&" where item_no ='"&

selitem &"'"

	Set rsup = Server.CreateObject ("ADODB.Recordset")

	rsup.open sqlup, cn

	

	set rsup=nothing

	sqllo="update ncheck set sc_l1='"& sc_l1 &"',scl1_quan="& check_quan &"

where item_no ='"& selitem &"' and user_login='" & session("applicant") &

"' and acname='" & session("tacname") & "'"

	Set rslo = Server.CreateObject ("ADODB.Recordset")

	rslo.open sqllo, cn



	set rslo=nothing

	else

	newquan=tquan - check_quan

	quan2=check_quan - scl1_quan

	'response.write newquan

	sqlup="update chem_info set scl1_quan = 0,scl2_quan = "& newquan&" where

item_no ='"& selitem &"'"

	Set rsup = Server.CreateObject ("ADODB.Recordset")

	rsup.open sqlup, cn



	set rsup=nothing

	sqllo="update ncheck set sc_l1='"& sc_l1 &"', sc_l2='"& sc_l2

&"',scl1_quan="& scl1_quan &",scl2_quan="& quan2 &" where item_no ='"&

selitem &"' and user_login='" & session("applicant") & "' and acname='" &

session("tacname") & "'"

	Set rslo = Server.CreateObject ("ADODB.Recordset")

	rslo.open sqllo, cn



	set rslo=nothing

	end if

	rss.close

	set rss=nothing

rsn.movenext

loop

rsn.close

set rsn=nothing



response.redirect "dgs_uform3.asp"

else%>  <div align="center"><br><font color=blue size=+1>You are not 

logged

in. </font> </div>

    <hr align="center">

 



<li> 

  <div align="center"><b>Please go back to the <a

href="dgs_index.asp">login page</a> 

    to log in.</B> <% end if %> </div>

</BODY>

</HTML> 



Thank you for your attention!



Jessica

Message #2 by "Ken Schaefer" <ken.s@a...> on Mon, 10 Jul 2000 16:52:42 +1000
Jessica,



You are creating too many recordsets...



Instead of:



> sqlup="update chem_info set scl1_quan="& newquan&" where item_no ='"&

> selitem &"'"

> Set rsup = Server.CreateObject ("ADODB.Recordset")

> rsup.open sqlup, cn

> rsup.close



Do this:



strSQL = "UPDATE chem_info "

strSQL = strSQL & "SET scl1_quan="& newquan&" "

strSQL = strSQL & "WHERE item_no ='"& selitem &"'"

cn.execute(strSQL)



That way you don't need to create any more recordsets - just execute the SQL

string against your existing connection object (which you open before your

loop)



Also, don't use ODBC, use OLEDB instead:

http://www.adOpenStatic.com/FAQ/whyOLEDB.asp



Cheers

Ken





----- Original Message -----

From: "Daniel Walker" <danielw@w...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, July 07, 2000 12:47 PM

Subject: [asp_databases] about error message "too many client tasks"





> Dear daniel,

>

> I got a problem when I was updating records (Access NT) for more than 20

> records using SQL. The error message was "too many client tasks". After

> the

> error message appeared, I must restart my computer to return everything to

> normal.

>

> The following is my asp code.

>



<snipped for your viewing comfort>




  Return to Index