Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
htown #1
Closing an ASP connection
I have used DW to generate the ASP code as I do not know much about it other
than the code that I have seen DW generate. My hosting server intermittently
gives me a "Out of resources" error every once in a while and they have assured
me that it is because of a coding issue that I am not closing my connections to
the server.
So I have looked in the code and am not able to find one. The problem is, I am
not sure where to put it either. Could someone help me out on this one please?
Thanks
Houston
here is the code:
<blockquote>quote:<br><hr><%
Dim rsComingTotal
Dim rsComingTotal_numRows
Set rsComingTotal = Server.CreateObject("ADODB.Recordset")
rsComingTotal.ActiveConnection = MM_conWhosComing_STRING
rsComingTotal.Source = "SELECT * FROM tblWhoLake"
rsComingTotal.CursorType = 0
rsComingTotal.CursorLocation = 2
rsComingTotal.LockType = 1
rsComingTotal.Open()
rsComingTotal_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats
variables
Dim rsComingTotal_total
Dim rsComingTotal_first
Dim rsComingTotal_last
' set the record count
rsComingTotal_total = rsComingTotal.RecordCount
' set the number of rows displayed on this page
If (rsComingTotal_numRows < 0) Then
rsComingTotal_numRows = rsComingTotal_total
Elseif (rsComingTotal_numRows = 0) Then
rsComingTotal_numRows = 1
End If
' set the first and last displayed record
rsComingTotal_first = 1
rsComingTotal_last = rsComingTotal_first + rsComingTotal_numRows - 1
' if we have the correct record count, check the other stats
If (rsComingTotal_total <> -1) Then
If (rsComingTotal_first > rsComingTotal_total) Then
rsComingTotal_first = rsComingTotal_total
End If
If (rsComingTotal_last > rsComingTotal_total) Then
rsComingTotal_last = rsComingTotal_total
End If
If (rsComingTotal_numRows > rsComingTotal_total) Then
rsComingTotal_numRows = rsComingTotal_total
End If
End If
%><hr></blockquote>:confused;
htown Guest
-
Closing connection of one user..
now i'm busy with this sharedball thing, so each one that connects gets his own ball.. (with attach function) but now i want do de-attach when... -
Closing one active ODBC connection
We run CF MX 7 (multi server) on Windows 2003. We have a data source that connects to RedBrick (RB) database. When we shutdonw RB for maintenance,... -
closing a DB connection? ASP/VBScript
Hi, A page on a site I have taken over has the following: <% myid = request.querystring("id") anyname="SELECT * from fleeces WHERE... -
Closing Database Connection
Hi Does any one know how to close a database connection in dreamweaver (I am using sql server and asp vbscript). My connection script is as... -
Commit on closing connection?
Hi there, using a Java program on OS390 and DB2 version 7, we have the following problem: After creating a connection using... -
Lionstone #2
Re: Closing an ASP connection
Every time you open a recordset, you must close it. DW does this on its
own.
It does hold the connection open until the page is completely rendered.
Perhaps there are too many users at one time, or too many recordsets on a
single page (each will have its own connection).
Also, if you use any redirects, but don't close your recordsets before the
redirect, those connections are left open.
"htown" <houston@hbip.com> wrote in message
news:e6a2nu$sem$1@forums.macromedia.com...>I have used DW to generate the ASP code as I do not know much about it
>other
> than the code that I have seen DW generate. My hosting server
> intermittently
> gives me a "Out of resources" error every once in a while and they have
> assured
> me that it is because of a coding issue that I am not closing my
> connections to
> the server.
>
> So I have looked in the code and am not able to find one. The problem is,
> I am
> not sure where to put it either. Could someone help me out on this one
> please?
>
> Thanks
> Houston
>
>
> here is the code:
> <blockquote>quote:<br><hr><%
> Dim rsComingTotal
> Dim rsComingTotal_numRows
>
> Set rsComingTotal = Server.CreateObject("ADODB.Recordset")
> rsComingTotal.ActiveConnection = MM_conWhosComing_STRING
> rsComingTotal.Source = "SELECT * FROM tblWhoLake"
> rsComingTotal.CursorType = 0
> rsComingTotal.CursorLocation = 2
> rsComingTotal.LockType = 1
> rsComingTotal.Open()
>
> rsComingTotal_numRows = 0
> %>
> <%
> ' *** Recordset Stats, Move To Record, and Go To Record: declare stats
> variables
>
> Dim rsComingTotal_total
> Dim rsComingTotal_first
> Dim rsComingTotal_last
>
> ' set the record count
> rsComingTotal_total = rsComingTotal.RecordCount
>
> ' set the number of rows displayed on this page
> If (rsComingTotal_numRows < 0) Then
> rsComingTotal_numRows = rsComingTotal_total
> Elseif (rsComingTotal_numRows = 0) Then
> rsComingTotal_numRows = 1
> End If
>
> ' set the first and last displayed record
> rsComingTotal_first = 1
> rsComingTotal_last = rsComingTotal_first + rsComingTotal_numRows - 1
>
> ' if we have the correct record count, check the other stats
> If (rsComingTotal_total <> -1) Then
> If (rsComingTotal_first > rsComingTotal_total) Then
> rsComingTotal_first = rsComingTotal_total
> End If
> If (rsComingTotal_last > rsComingTotal_total) Then
> rsComingTotal_last = rsComingTotal_total
> End If
> If (rsComingTotal_numRows > rsComingTotal_total) Then
> rsComingTotal_numRows = rsComingTotal_total
> End If
> End If
> %><hr></blockquote>:confused;
>
Lionstone Guest
-
htown #3
Re: Closing an ASP connection
Well, I thought it was strange that DW would not do that on its own. I only
have 4 recordsets on the page and I intermittently get this error. So now I am
beginning to think that it's the server that I am on at the hosting company. I
am sure they are packing in them but with there current changeover I would
think they would be loosing customers like crazy. I will be one of them soon
enough.
Any other thoughts on this topic would be appreciated.
htown Guest



Reply With Quote

