Example #1
0
        private void addIndexToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormAddIndex formAddIndex = new FormAddIndex();
            formAddIndex.labelTableName.Text = CurrentTablename;
            string ColumnName = dataGridViewOracleFields.CurrentRow.Cells["cname"].Value.ToString();
            formAddIndex.textBoxIndexName.Text = string.Format("NDX_{0}", ColumnName);
            formAddIndex.dataGridViewColumnName.Rows.Add(new string[] { ColumnName });

            if (formAddIndex.ShowDialog() == DialogResult.OK)
            {
                if (connexion.DoCmd(formAddIndex.textBoxSql.Text))
                {
                    //Add here the refresh of the tree
                }
            }
        }
Example #2
0
        private void createIndexToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode currentNode = treeViewOracleSchema.SelectedNode;
            //TreeNode RootNode = currentNode.Parent;
            TreeNode TableNode = currentNode;
            TreeNode FieldNode = currentNode;

            while (TableNode != null && ((DbObjectItem)TableNode.Tag).Type != "table")
            {
                TableNode = TableNode.Parent;
            }

            while (FieldNode != null && ((DbObjectItem)FieldNode.Tag).Type != "field")
            {
                FieldNode = FieldNode.Parent;
            }

            if (FieldNode != null && TableNode != null)
            {
                FormAddIndex formAddIndex = new FormAddIndex();
                formAddIndex.labelTableName.Text = TableNode.Text;
                formAddIndex.textBoxIndexName.Text = string.Format("NDX_{0}", FieldNode.Text);
                formAddIndex.dataGridViewColumnName.Rows.Add(new string[] {FieldNode.Text});

                if (formAddIndex.ShowDialog() == DialogResult.OK)
                {
                    if (connexion.DoCmd(formAddIndex.textBoxSql.Text))
                    {
                        TableNode.Nodes.Clear();
                        GetTreeChildDetail(TableNode);
                    }
                }

                //string sql = String.Format("CREATE INDEX NDX_{0} ON {1} ({0})", FieldNode.Text, TableNode.Text);
                //MessageBox.Show(sql);
                //connexion.DoCmd(sql);
                //TableNode.Nodes.Clear();
                //GetTreeChildDetail(TableNode);
            }
        }