Esempio n. 1
0
        /*
         * Init all columns
         */
        private void InitColumnsControlls()
        {
            // clear current query
            DropDownListKey.DataSource = null;
            DropDownListKey.DataBind();

            // list selected table: to be removed
            //Label1.Text = ListBoxTables.SelectedItem.ToString();

            string sQueryText = "SELECT COLUMN_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" +
                                DropDownListTables.SelectedItem.ToString() + "'ORDER BY ORDINAL_POSITION";

            // execute query
            SQLManager manager  = new SQLManager(sCatalog);
            DataTable  objTable = new DataTable();

            // handle errors
            //if (manager.GetQueryResult(sQueryText) == null)
            //{
            //    HandleQueryError();
            //    return;
            //}

            objTable.Load(manager.GetQueryResult(sQueryText));

            DropDownListKey.DataSource     = objTable;
            DropDownListKey.DataTextField  = "COLUMN_NAME";
            DropDownListKey.DataValueField = "ORDINAL_POSITION";
            DropDownListKey.DataBind();

            manager.CloseConnection();

            // init input columns
            InitCheckboxFields();
        }
Esempio n. 2
0
        /*
         * Init all attributes
         */
        private void InitAttributes()
        {
            // clear current query
            DropDownListKey.DataSource = null;
            DropDownListKey.DataBind();

            MiningManager objMiningManager = new MiningManager();

            string sQuery = "SELECT HIERARCHY_NAME FROM $system.mdschema_hierarchies WHERE CUBE_NAME = '" +
                            DropDownListCubes.SelectedItem.Text + "' AND [DIMENSION_UNIQUE_NAME] = '[" +
                            DropDownListDimensions.SelectedItem.Text + "]'";

            // display results
            Microsoft.AnalysisServices.AdomdClient.AdomdDataReader objMiningData = objMiningManager.GetQueryResult(sQuery);

            List <string> sCubes = new List <string>();

            try
            {
                while (objMiningData.Read())
                {
                    for (int i = 0; i < objMiningData.FieldCount; i++)
                    {
                        object value    = objMiningData.GetValue(i);
                        string strValue = (value == null) ? string.Empty : value.ToString();
                        sCubes.Add(strValue);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }

            DropDownListKey.DataSource = sCubes;
            DropDownListKey.DataBind();

            // init input columns
            sQuery = "SELECT HIERARCHY_NAME FROM $system.mdschema_hierarchies WHERE CUBE_NAME = '" +
                     DropDownListCubes.SelectedItem.Text + "' AND [DIMENSION_UNIQUE_NAME] = '[" +
                     DropDownListDimensions.SelectedItem.Text + "]' AND HIERARCHY_NAME <> '" + DropDownListKey.SelectedItem.Text + "'";
            InitAttributeAndMeasures(sQuery, GridViewAttributes);

            // init measures
            sQuery = "SELECT MEASURE_NAME FROM $system.mdschema_measures WHERE CUBE_NAME = '" +
                     DropDownListCubes.SelectedItem.Text + "'";
            InitAttributeAndMeasures(sQuery, GridViewMeasures);
        }
Esempio n. 3
0
        /*
         * Initialize column names in checkbox list and dropdown box
         */
        void InitializeColumns(DataTable objMainTable)
        {
            if (objMainTable == null)
            {
                return;
            }

            // reset controlls
            DropDownListKey.DataSource = null;
            DropDownListKey.DataBind();

            CheckBoxListInputColumns.DataSource = null;
            CheckBoxListInputColumns.DataBind();

            // add columns
            for (int i = 0; i < objMainTable.Columns.Count; i++)
            {
                DropDownListKey.Items.Add(objMainTable.Columns[i].ColumnName.ToString());
                CheckBoxListInputColumns.Items.Add(objMainTable.Columns[i].ColumnName.ToString());
            }

            DropDownListKey.DataBind();
            CheckBoxListInputColumns.DataBind();
        }