コード例 #1
0
        private void btDelChild_Click(object sender, System.EventArgs e)
        {
            TableNode nd = treeView1.SelectedNode as TableNode;

            if (nd != null)
            {
                TableNode ndParent = nd.Parent as TableNode;
                if (ndParent != null)
                {
                    string s = Resource1.deLinkTbl;
                    if (MessageBox.Show(this, s, this.Text, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        TableReference rel = schema.FindRelation(ndParent.table.TableName, nd.table.TableName);
                        if (rel == null)
                        {
                            MessageBox.Show(this, Resource1.relNotFound, this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            qry.DatabaseConnection.ConnectionObject.DropRelation(nd.table.TableName, rel.RefName);
                            ndParent.Nodes.Remove(nd);
                            treeView1.SelectedNode = ndParent;
                        }
                    }
                }
            }
        }