Connect() private method

private Connect ( System.Data.SqlClient.ServerInfo serverInfo, System.Data.SqlClient.SqlInternalConnectionTds connHandler, bool ignoreSniOpenTimeout, long timerExpire, bool encrypt, bool trustServerCert, bool integratedSecurity, bool withFailover ) : void
serverInfo System.Data.SqlClient.ServerInfo
connHandler System.Data.SqlClient.SqlInternalConnectionTds
ignoreSniOpenTimeout bool
timerExpire long
encrypt bool
trustServerCert bool
integratedSecurity bool
withFailover bool
return void
示例#1
0
        private void OpenAndLogin()
        {
            // Open the connection and Login
            try {
                int timeout = _connectionOptions.ConnectTimeout;

                _parser = new TdsParser();
                timeout = _parser.Connect(_connectionOptions.DataSource,
                                          _connectionOptions.NetworkLibrary,
                                          this,
                                          timeout,
                                          _connectionOptions.Encrypt);

                this.Login(timeout);

                _fConnectionOpen = true; // mark connection as open
            }
            catch (Exception e) {
                ADP.TraceException(e);

                // If the parser was allocated and we failed, then we must have failed on
                // either the Connect or Login, either way we should call Disconnect.
                // Disconnect can be called if the connection is already closed - becomes
                // no-op, so no issues there.
                if (_parser != null)
                {
                    _parser.Disconnect();
                }

                throw e;
            }
        }