Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Utilisation des événement de ADO.NET

Recherche,dans,la,base,de,données:,non,édité
{filelink=16146}

/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 * Version: 1
 */
using System;
using System.Data;
using System.Data.SqlClient;
 
namespace Base_de_données
{
    public class UsingADONETEvents
    {
        static void Main(string[] args)
        {
            SqlConnection connexion = new SqlConnection(@"Data Source=(local); Initial Catalog =MesExemples.com; Integrated Security=true");
 
            connexion.StateChange += new StateChangeEventHandler(OnStateChange);
            connexion.Open();
            connexion.Close();
        }
        public static void OnStateChange(object sender, System.Data.StateChangeEventArgs e)
        {
            Console.WriteLine("L'etat dela connexion changé: {0}", ((SqlConnection)sender).State);
        }
    }
}

No comments yet.

Leave a Comment