Connection Events

This section illustrates how you can use the events that belong to the SqlConnection class. There are two events that SqlConnection exposes. These are shown in Table 18.4.

Table 18.4. Connection Object Events
Connection EventDescription
InfoMessageFires when a warning or informational message is sent by the database server.
StateChangeFires whenever the state changes from open to closed or visa versa.

Listing 18.2 illustrates how to process the information contained in the SQLConnection class events.

Listing 18.2. Events in the SQLConnection Object
1: program events; 2: 3: {$APPTYPE CONSOLE} 4: 5: {%DotNetAssemblyCompiler 'c:\windows\microsoft.net\framework\v1.1.4322\System.Data.dll'} 6: uses 7: SysUtils, 8: System.Data, 9: System.Data.SQLClient, ...

Get Delphi for .NET Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.