Closing an ASP connection

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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,...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139