コード例 #1
0
        private void tvTablesColumns_ExpandTable(TreeNode tNode)
        {
            if (tNode.Parent == null)                   // Check for Tables or Views
            {
                return;
            }

            if (tNode.FirstNode.Text != "")             // Have we already filled it out?
            {
                return;
            }

            // Need to obtain the column information for the requested table/view
            // suppress redraw until tree view is complete
            tvTablesColumns.BeginUpdate();

            string           sql        = "SELECT * FROM " + DesignerUtility.NormalizeSqlName(tNode.Text);
            List <SqlColumn> tColumns   = DesignerUtility.GetSqlColumns(_Draw, _DataSource, sql);
            bool             bFirstTime = true;

            foreach (SqlColumn sc in tColumns)
            {
                if (bFirstTime)
                {
                    bFirstTime           = false;
                    tNode.FirstNode.Text = sc.Name;
                }
                else
                {
                    tNode.Nodes.Add(sc.Name);
                }
            }

            tvTablesColumns.EndUpdate();
        }
コード例 #2
0
        private void bRefresh_Click(object sender, System.EventArgs e)
        {
            // Need to clear all the fields and then replace with the columns
            //   of the SQL statement
            List <SqlColumn> cols = DesignerUtility.GetSqlColumns(_Draw, cbDataSource.Text, tbSQL.Text);

            if (cols == null || cols.Count <= 0)
            {
                return;                                         // something didn't work right
            }
            _dsv.Fields.Rows.Clear();
            string[] rowValues = new string[4];
            foreach (SqlColumn sc in cols)
            {
                rowValues[0] = sc.Name;
                rowValues[1] = sc.Name;
                rowValues[2] = "";
                rowValues[3] = sc.DataType.FullName;
                _dsv.Fields.Rows.Add(rowValues);
            }
        }