internal bool ConnectDataSource(Report rpt)
        {
            IDbConnection cn = GetConnection(rpt);

            if (cn != null)
            {
                return(true);
            }

            if (_DataSourceReference != null)
            {
                ConnectDataSourceReference(rpt);                        // this will create a _ConnectionProperties
            }
            if (_ConnectionProperties == null ||
                _ConnectionProperties.ConnectstringValue == null)
            {
                return(false);
            }

            bool rc = false;

            try
            {
                cn = EngineConfig.GetConnection(_ConnectionProperties.DataProvider,
                                                _ConnectionProperties.Connectstring(rpt));
                if (cn != null)
                {
                    cn.Open();
                    rc = true;
                }
            }
            catch (Exception e)
            {
                string err = string.Format("DataSource '{0}'.\r\n{1}", _Name,
                                           e.InnerException == null? e.Message: e.InnerException.Message);
                if (rpt == null)
                {
                    OwnerReport.rl.LogError(4, err);                            // error occurred during parse phase
                }
                else
                {
                    rpt.rl.LogError(4, err);
                }
                if (cn != null)
                {
                    cn.Close();
                    cn = null;
                }
            }

            if (cn != null)
            {
                SetSysConnection(rpt, cn);
            }
            else
            {
                string err = string.Format("Unable to connect to datasource '{0}'.", this._Name.Nm);
                if (rpt == null)
                {
                    OwnerReport.rl.LogError(4, err);                            // error occurred during parse phase
                }
                else
                {
                    rpt.rl.LogError(4, err);
                }
            }
            return(rc);
        }