ASP.NET
  Home arrow ASP.NET arrow Page 11 - The Connection Object
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

The Connection Object
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 19
    2004-09-27

    Table of Contents:
  • The Connection Object
  • Connection State
  • The Cancel Method
  • The Execute Method
  • The Open Method
  • The OpenSchema Method
  • Properties of the Connection Object
  • The ConnectionTimeout Property and More
  • The Mode Property and Provider Property
  • The State Property and Version Property
  • Events of the Connection Object
  • The BeginTransComplete Event
  • The Disconnect Event
  • The RollbackTransComplete Event
  • Collections of the Connection Object

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Connection Object - Events of the Connection Object


    (Page 11 of 15 )

    Connection events can be quickly summarized as follows:

    • BeginTransComplete is raised after a transaction has begun.

    • CommitTransComplete is raised after a transaction has been committed.

    • ConnectComplete is raised after the connection has been established.

    • Disconnect is raised after a connection has been closed.

    • ExecuteComplete is raised after an Execute method call has completed.

    • InfoMessage is raised when the provider returns extra information.

    • RollbackTransComplete is raised after a transaction has been rolled back.

    • WillConnect is raised just before the connection is established.

    • WillExecute is raised just before a statement is executed.

    These events work in both synchronous and asynchronous modes.

    All events will have a bidirectional parameter, adStatus, to indicate the status of the event. This is of type EventStatusEnum, and on entry to the procedure can be one of the following constants:

    • adStatusOK indicates that the action that caused the event was successful.

    • adStatusErrorsOccured indicates that errors or warnings occurred, in which case the Errors collection should be checked.

    • adStatusCantDeny indicates on a Will... event that you cannot cancel the action that generated the event, and on a ...Complete event indicates that the action was cancelled.

    • adStatusUnwantedEvent indicates that the action that generated the event should no longer generate events.

    On a Will... event (and assuming adStatusCantDeny is not set), before the procedure exits you can set adStatus to adStatusCancel to cancel the action that caused this event. This also generates an error indicating the event has been cancelled. For example, assume that you have moved from one record to the next; this will raise a WillMove event on the recordset. If you decide not to move to another record, you can set adStatus to adStatusCancel, and the Move action will be cancelled. This allows you to cancel actions where the data is incorrect.

    When using Will... events, one thing to watch for is implicit method calls. Taking the preceding Move as an example, if the current record has been edited, then ADO implicitly calls Update. In this case you might get more than one Will... event. I discuss this in more detail in Chapter 5.

    If you no longer wish to receive events for a particular action, then before the procedure exits, you can set adStatus to adStatusUnwantedEvent, and they will no longer be generated. 

    This is from ADO Programmer's Reference, by Dave Sussman (Apress, ISBN 1590593421). Check it out at your favorite bookstore today. Buy this book now.

    More ASP.NET Articles
    More By Apress Publishing


     

    ASP.NET ARTICLES

    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT