Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











EVENT:  Connection::Disconnect

Disconnect adStatus, pConnection
 
The Disconnect event can be fired after a connection ends. This event is one of three connection management events that can be called. The other two are ConnectComplete and WillConnect.
 
An event is simply a subroutine that can be called automatically after a specific operation has occurred. This subroutine can contain any code that you need to run when the event occurs. The subroutine will only be called if it is included in your code. Future calls to the event subroutine can be cancelled by setting the adStatus parameter to be the adStatusUnwantedEvent constant (see table below) before the event returns.
 
There are two parameters that are passed to this event.
 
The adStatus parameter is normally set to the adStatusOK value of the EventStatusEnum constants.
 
EventStatusEnum Constants
 
Constant Value Description
adStatusCancel 4 Cancels the operation that fired the event
adStatusCantDeny 3 Cannot cancel pending operation
adStatusErrorsOccurred 2 Indicates that warnings and/or errors occurred
adStatusOK 1 The operation that fired the event was successful
adStatusUnwantedEvent 5 The operation that generated the event cannot generate future events

 
The pConnection parameter is the Connection object that is associated with this event.
 
Code (Visual Basic):
' Use the WithEvents keyword to designate that events
' can be handled by this Connection object
Dim WithEvents objConn As ADODB.Connection

' Note how the object name, objConn, is incorporated into the event Sub name
Private Sub objConn_Disconnect( adStatus As ADODB.EventStatusEnum, _
   ByVal pConnection As ADODB.Connection )

' place any code you desire here, for example
If adStatus = adStatusOK Then
   Print "The disconnect was successful"
Else
   Print "The disconnect status is " & adStatus
End If

End Sub

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information