Example #1
0
        static internal List <SqlColumn> GetSqlColumns(DesignXmlDraw d, string ds, string sql)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            if (dsNode == null)
            {
                return(null);
            }
            string  dataProvider;
            string  connection;
            XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");

            if (dp == null)
            {
                return(null);
            }
            dataProvider = dp.InnerText;
            dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
            if (dp == null)
            {
                return(null);
            }
            connection = dp.InnerText;
            IList parameters = null;

            return(GetSqlColumns(dataProvider, connection, sql, parameters));
        }
Example #2
0
        static internal List <SqlSchemaInfo> GetSchemaInfo(DesignXmlDraw d, string ds)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            if (dsNode == null)
            {
                return(null);
            }

            string  dataProvider;
            string  connection;
            XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");

            if (dp == null)
            {
                return(null);
            }
            dataProvider = dp.InnerText;
            dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
            if (dp == null)
            {
                return(null);
            }
            connection = dp.InnerText;
            return(GetSchemaInfo(dataProvider, connection));
        }
        static internal bool GetConnnectionInfo(DesignXmlDraw d, string ds, out string dataProvider, out string connection)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            dataProvider = null;
            connection   = null;
            if (dsNode == null)
            {
                return(false);
            }

            string dataSourceReference = d.GetElementValue(dsNode, "DataSourceReference", null);

            if (dataSourceReference != null)
            {
                //  This is not very pretty code since it is assuming the structure of the windows parenting.
                //    But there isn't any other way to get this information from here.
                Control  p  = d;
                MDIChild mc = null;
                while (p != null && !(p is RdlDesigner))
                {
                    if (p is MDIChild)
                    {
                        mc = (MDIChild)p;
                    }

                    p = p.Parent;
                }
                if (p == null || mc == null || mc.SourceFile == null)
                {
                    MessageBox.Show("Unable to locate DataSource Shared file.  Try saving report first");
                    return(false);
                }
                string filename = Path.GetDirectoryName(mc.SourceFile) + Path.DirectorySeparatorChar + dataSourceReference;
                if (!DesignerUtility.GetSharedConnectionInfo((DesignerForm)p, filename, out dataProvider, out connection))
                {
                    return(false);
                }
            }
            else
            {
                XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");
                if (dp == null)
                {
                    return(false);
                }
                dataProvider = dp.InnerText;
                dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
                if (dp == null)
                {
                    return(false);
                }
                connection = dp.InnerText;
            }
            return(true);
        }
Example #4
0
        static internal List<SqlSchemaInfo> GetSchemaInfo(DesignXmlDraw d, string ds)
		{
			XmlNode dsNode = d.DataSourceName(ds);
			if (dsNode == null)
				return null;

			string dataProvider;
			string connection;
			XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");
			if (dp == null)
				return null;
			dataProvider = dp.InnerText;
			dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
			if (dp == null)
				return null;
			connection = dp.InnerText;
			return GetSchemaInfo(dataProvider, connection);
		}
Example #5
0
        static internal List<SqlColumn> GetSqlColumns(DesignXmlDraw d, string ds, string sql)
		{
			XmlNode dsNode = d.DataSourceName(ds);
			if (dsNode == null)
				return null;
			string dataProvider;
			string connection;
			XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");
			if (dp == null)
				return null;
			dataProvider = dp.InnerText;
			dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
			if (dp == null)
				return null;
			connection = dp.InnerText;
			IList parameters=null;

			return GetSqlColumns(dataProvider, connection, sql, parameters);
		}