/// <summary>
        /// Initializes new instance of <see cref="MsSqlDataConnection"/> object.
        /// </summary>
        /// <param name="provider"><see cref="MsSqlDataProvider"/> that current <see cref="MsSqlDataConnection"/> is created by.</param>
        /// <param name="connectionID">Current <see cref="MsSqlDataConnection"/> unique id.</param>
        /// <param name="openOnInitialize">If true, opens connection to database engine just after initialization.</param>
        internal MsSqlDataConnection( MsSqlDataProvider provider, byte connectionID, bool openOnInitialize )
            : base(provider, connectionID)
        {
            SqlServerConnection = new SqlConnection(provider.ConnectionString);
            OnConnected += new ConnectionConnectedEventDelegate(provider.ConnectionConnected);
            OnDisconnected += new ConnectionDisconnectedEventDelegate(provider.ConnectionDisconnected);

            if ( openOnInitialize )
                Open();
        }
Exemple #2
0
        /// <summary>
        /// Initializes new instance of <see cref="MsSqlDataConnection"/> object.
        /// </summary>
        /// <param name="provider"><see cref="MsSqlDataProvider"/> that current <see cref="MsSqlDataConnection"/> is created by.</param>
        /// <param name="connectionID">Current <see cref="MsSqlDataConnection"/> unique id.</param>
        /// <param name="openOnInitialize">If true, opens connection to database engine just after initialization.</param>
        internal MsSqlDataConnection(MsSqlDataProvider provider, byte connectionID, bool openOnInitialize)
            : base(provider, connectionID)
        {
            SqlServerConnection = new SqlConnection(provider.ConnectionString);
            OnConnected        += new ConnectionConnectedEventDelegate(provider.ConnectionConnected);
            OnDisconnected     += new ConnectionDisconnectedEventDelegate(provider.ConnectionDisconnected);

            if (openOnInitialize)
            {
                Open();
            }
        }