Ejemplo n.º 1
0
        private ColumnChooser GetTheColumns()
        {
            myCC = new ColumnChooser(TabThatNeedsCols.ToString(), this);

            getColsSQL  = "select column_name, data_type, character_maximum_length ";
            getColsSQL += "from information_schema.columns where (table_name = '";
            getColsSQL += TabThatNeedsCols.ToString() + "')";
            colListing.Clear();
            SqlCommand cmd = DBConnection.CreateCommand();

            using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
            {
                cmd.CommandText = getColsSQL;
                cmd.CommandType = CommandType.Text;
                colCounter      = sda.Fill(colListing);
            }

            myCC.lbColumnLister.Items.Clear();
            foreach (DataRow oneCol in colListing.Rows)
            {
                myCC.lbColumnLister.Items.Add(oneCol[0] + "\t" + oneCol[1] + "\t" + oneCol[2]);
            }

            return(myCC);
        }
Ejemplo n.º 2
0
        private void JoinButtonLogic(string JoinType)
        {
            // fill the column textboxes with column info

            saveJoinType     = JoinType;
            LeftSideJoinTab  = lbJoined.CheckedItems[0].ToString();
            RightSideJoinTab = lbUnjoined.CheckedItems[0].ToString();
            queryTabInfo  LeftTabInfo = getQTinfoFor(LeftSideJoinTab);
            List <string> LeftTabCols = LeftTabInfo.showColumns;

            lblJoinedTab.Text   = LeftSideJoinTab;
            lblUnjoinedTab.Text = RightSideJoinTab;

            clbLeftCols.Items.Clear();
            foreach (string OneCol in LeftTabCols)
            {
                clbLeftCols.Items.Add(OneCol);
            }

            TabThatNeedsCols = lbUnjoined.CheckedItems[0];
            myCC             = GetTheColumns();
            clbRightCols.Items.Clear();
            foreach (object OneCol in myCC.lbColumnLister.Items)
            {
                clbRightCols.Items.Add(OneCol);
            }

            // auto check columns with same names

            this.gbColsJoin.Visible = true;
            this.Refresh();
            Application.DoEvents();
        }
Ejemplo n.º 3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            TabThatNeedsCols = lbJoined.CheckedItems[0];
            queryTabInfo  myTabInfo      = getQTinfoFor(TabThatNeedsCols.ToString());
            List <string> alreadyChecked = myTabInfo.showColumns;

            myCC = GetTheColumns(alreadyChecked);
            Application.DoEvents();
            myCC.ShowDialog();

            if (GetReturnedColumns().Count == 0)
            {
                // what happens if they deselect all the columns?
            }

            myTabInfo.showColumns = GetReturnedColumns();
            queryParms[qpIndex]   = myTabInfo;
            myCC.Close();
        }
Ejemplo n.º 4
0
        public void JFinitialize()
        {
            frmTabDispParent.Hide();
            this.Top  = frmTabDispParent.PlaceForms.topForm;
            this.Left = frmTabDispParent.PlaceForms.LeftForm;

            Application.DoEvents();

            bool firstObj = true;

            foreach (object OneTab in passedJoinedTabs)
            {
                if (firstObj)
                {
                    lbJoined.Items.Add(OneTab);
                    TabThatNeedsCols = OneTab;
                    firstObj         = false;
                }
                else
                {
                    lbUnjoined.Items.Add(OneTab);
                }
            }

            myCC = GetTheColumns();

            Application.DoEvents();
            myCC.ShowDialog();

            if (GetReturnedColumns().Count == 0)
            {
                // what happens if they didn't select any columns the first time?
            }

            var myqTinfo = new queryTabInfo();

            myqTinfo.TableName   = TabThatNeedsCols.ToString();
            myqTinfo.showColumns = GetReturnedColumns();

            queryParms.Add(myqTinfo);
            myCC.Close();
        }
Ejemplo n.º 5
0
        private bool GetColsToShowRight(ColumnChooser myCC)
        {
            this.Hide();
            Application.DoEvents();
            myCC.ShowDialog();

            if (GetReturnedColumns().Count == 0)
            {
                UndoTheJoin();
                myCC.Close();
                return(false);
            }

            var myqTinfo = new queryTabInfo();

            myqTinfo.TableName   = TabThatNeedsCols.ToString();
            myqTinfo.showColumns = GetReturnedColumns();

            myCC.Close();
            return(true);
        }