Beispiel #1
0
        /*
         * Select all the column names for the selected table
         */
        protected void ListBoxTables_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Sets the array count variable makes sure index is not -1.
            if (ListBoxTables.SelectedIndex >= 0)
            {
                // clear current query
                GridViewData.DataSource = null;
                GridViewData.DataBind();

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

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

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

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

                objTable.Load(manager.GetQueryResult(sQueryText));
                GridViewMain.DataSource = objTable;
                GridViewMain.DataBind();
                manager.CloseConnection();
            }
        }
Beispiel #2
0
        /*
         * Run selected query and populate the data grid
         */
        private void ExecuteRelationalQuery(string sQuery)
        {
            SQLManager manager  = new SQLManager(sSelectedDB);
            DataTable  objTable = new DataTable();

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

            objTable.Load(manager.GetQueryResult(sQuery));
            GridViewData.DataSource = objTable;
            GridViewData.DataBind();
            manager.CloseConnection();

            // store the data table and prepare the mining link
            Session.Add("queryData", objTable);
            Session.Add("queryTable", ListBoxTables.SelectedItem.ToString());
            Session.Add("queryDB", DropDownListDatabases.SelectedItem.ToString());
        }
        /*
         * Run selected query and populate the data grid
         */
        private void ExecuteRelationalQuery(string sQuery)
        {
            SQLManager manager = new SQLManager(sSelectedDB);
            DataTable objTable = new DataTable();

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

            objTable.Load(manager.GetQueryResult(sQuery));
            GridViewData.DataSource = objTable;
            GridViewData.DataBind();
            manager.CloseConnection();

            // store the data table and prepare the mining link
            Session.Add("queryData", objTable);
            Session.Add("queryTable", ListBoxTables.SelectedItem.ToString());
            Session.Add("queryDB", DropDownListDatabases.SelectedItem.ToString());
        }
        /*
         * Select all the column names for the selected table
         */
        protected void ListBoxTables_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Sets the array count variable makes sure index is not -1.
            if (ListBoxTables.SelectedIndex >= 0)
            {
                // clear current query
                GridViewData.DataSource = null;
                GridViewData.DataBind();

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

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

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

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

                objTable.Load(manager.GetQueryResult(sQueryText));
                GridViewMain.DataSource = objTable;
                GridViewMain.DataBind();
                manager.CloseConnection();
            }
        }