Exemple #1
0
        void ConnectDataSourceReference(Report rpt)
        {
            if (_ConnectionProperties != null)
            {
                return;
            }

            try
            {
                string file;
                string folder = rpt == null? OwnerReport.ParseFolder: rpt.Folder;
                if (folder == null)
                {   // didn't specify folder; check to see if we have a fully formed name
                    if (!_DataSourceReference.EndsWith(".dsr", StringComparison.InvariantCultureIgnoreCase))
                    {
                        file = _DataSourceReference + ".dsr";
                    }
                    else
                    {
                        file = _DataSourceReference;
                    }
                }
                else if (_DataSourceReference[0] != Path.DirectorySeparatorChar)
                {
                    file = folder + Path.DirectorySeparatorChar + _DataSourceReference + ".dsr";
                }
                else
                {
                    file = folder + _DataSourceReference + ".dsr";
                }

                string pswd = OwnerReport.GetDataSourceReferencePassword == null?
                              null: OwnerReport.GetDataSourceReferencePassword();
                if (pswd == null)
                {
                    throw new Exception("No password provided for shared DataSource reference");
                }

                string      xml  = RDL.DataSourceReference.Retrieve(file, pswd);
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(xml);
                XmlNode xNodeLoop = xDoc.FirstChild;

                _ConnectionProperties = new ConnectionProperties(OwnerReport, this, xNodeLoop);
                _ConnectionProperties.FinalPass();
            }
            catch (Exception e)
            {
                OwnerReport.rl.LogError(4, e.Message);
                _ConnectionProperties = null;
            }
            return;
        }
Exemple #2
0
        void ConnectDataSourceReference(Report rpt)
        {
            if (_ConnectionProperties != null)
            {
                return;
            }

            try
            {
                string file;
                string folder = rpt == null? OwnerReport.ParseFolder: rpt.Folder;
                if (_DataSourceReference[0] != Path.DirectorySeparatorChar)
                {
                    file = folder + Path.DirectorySeparatorChar + _DataSourceReference + ".dsr";
                }
                else
                {
                    file = folder + _DataSourceReference + ".dsr";
                }

                string pswd = OwnerReport.GetDataSourceReferencePassword == null?
                              null: OwnerReport.GetDataSourceReferencePassword();
                if (pswd == null)
                {
                    throw new Exception("No password provided for shared DataSource reference");
                }

                string      xml  = RDL.DataSourceReference.Retrieve(file, pswd);
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(xml);
                XmlNode xNodeLoop = xDoc.FirstChild;

                _ConnectionProperties = new ConnectionProperties(OwnerReport, this, xNodeLoop);
                _ConnectionProperties.FinalPass();
            }
            catch (Exception e)
            {
                OwnerReport.rl.LogError(4, e.Message);
                _ConnectionProperties = null;
            }
            return;
        }