Are ADO objects destroyed if user exits before an ASP page loads?

Results 1 to 2 of 2

Thread: Are ADO objects destroyed if user exits before an ASP page loads?

  1. #1
    Join Date
    Dec 1969
    Posts
    1,671

    Default Are ADO objects destroyed if user exits before an ASP page loads?

    I have an ASP driven application that loads list boxes (Interdev DTCs) based on a call to a database. I am using all server-sided code for the example below.<BR><BR>Simplistically modeled as...<BR>-----<BR>Set myConn=ServerCreateObject("ADODB.Connection")<BR>S et myRs=ServerCreateObject("ADODB.Recordset")<BR>myco nn.open &#060;some connection string&#062;<BR>myRs.open &#060;some SQL statment&#062;,myconn<BR>if not myRs.EOF and not MyRs.BOF then<BR>*myRs.movefirst<BR>**do while not myRs.EOF<BR>***Mylistbox.additem myrs("SomeField"),myrs("SomeotherField")<BR>*** myrs.movenext<BR>**loop<BR>end if<BR>myrs.close<BR>set myrs=nothing<BR>myconn.close<BR>set myconn=nothing<BR>-------<BR><BR>Sometimes these recordsets take a while to be filled due to the complexity of the SQL statements being used on the database. What if the client bails out prior to the finish of the code? Will the ADO objects ever get destroyed by my code ?<BR>Does the server actually finish the code even if the client navigates away? Or am I depending "?something else?" to close and destroy my objects?.<BR><BR>Thanks,<BR>Mike

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Are ADO objects destroyed if user exits before an ASP page loads?

    From what I understand, when an ASP page is requested from a client, it runs to completion. So, if your user disconnects (i.e. hits stop on his browser, closes his browser, etc.), the ASP page will continue until it is finished executing, at which time it will free up the ADO objects.<BR><BR>You can use a method of the Response object, .IsClientConnected, to determine if the client is still connected! (duh!)<BR><BR>There is a good example of using this over at ActiveServerPages.com:<BR>http://www.activeserverpages.com/learn/isclientconnected.asp<BR><BR>Happy Programming!

Posting Permissions

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