예제 #1
0
파일: DataSources.cs 프로젝트: mnisl/OD
		ListDictionary _Items;		// list of report items

		internal DataSources(Report rpt, DataSourcesDefn dsds)
		{
			_rpt = rpt;
			_Items = new ListDictionary();

			// Loop thru all the child nodes
			foreach(DataSourceDefn dsd in dsds.Items.Values)
			{
				DataSource ds = new DataSource(rpt, dsd);
				_Items.Add(dsd.Name.Nm,	ds);
			}
		}
예제 #2
0
        private void bDataSource_Click(object sender, System.EventArgs e)
        {
            if (this.rdlViewer.SourceRdl == null)
            {
                MessageBox.Show("Hit the Set Report button first!");
                return;
            }
            Cursor saveCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            IDbConnection cnSQL = null;

            try
            {
                cnSQL = new SqlConnection(this.tbConnectionString.Text);
                cnSQL.Open();

                // Tell the report to use this connection
                Report rpt = this.rdlViewer.Report;                                     // Get the report
                fyiReporting.RDL.DataSource ds = rpt.DataSources["DS1"];                // get the data source
                ds.UserConnection = cnSQL;
                // reset call to set user data (if made)
                fyiReporting.RDL.DataSet dts = rpt.DataSets["Data"];    // get the data set
                dts.SetData((XmlDocument)null);                         // this will clear out user data (if any); otherwise userdata would override

                rdlViewer.Rebuild();                                    // force report to get rebuilt
                ds.UserConnection = null;                               // clear it out
            }
            catch (SqlException sqle)
            {
                MessageBox.Show(sqle.Message, "SQL Error");
            }
            catch (Exception ge)
            {
                MessageBox.Show(ge.Message, "Error");
            }
            finally
            {
                if (cnSQL != null)
                {
                    cnSQL.Close();
                    cnSQL.Dispose();
                }
                Cursor.Current = saveCursor;
            }
        }
예제 #3
0
		ArrayList _Items;			// list of report items

		internal DataSources(Report r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			// Run thru the attributes
//			foreach(XmlAttribute xAttr in xNode.Attributes)
//			{
//			}
			_Items = new ArrayList();
			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				if (xNodeLoop.Name == "DataSource")
				{
					DataSource ds = new DataSource(r, this, xNodeLoop);
					_Items.Add(ds);
				}
			}
			if (_Items.Count == 0)
				OwnerReport.rl.LogError(8, "For DataSources at least one DataSource is required.");
		}