/// <summary>
        /// 查找关联关系
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bSearch_Click(object sender, EventArgs e)
        {
            string fieldValue = searchFieldBox.Text;

            if (fieldValue != "")
            {
                if (keyFieldTree.SelectedNode != null && keyFieldTree.SelectedNode.Level == 1)
                {
                    Hashtable infoTable = new Hashtable();

                    foreach (Node tableNode in relationTree.Nodes)
                    {
                        List <string> fieldList = new List <string>();

                        foreach (Node fieldNode in tableNode.Nodes)
                        {
                            fieldList.Add(GetFieldName(fieldNode.Text));
                        }

                        infoTable[tableNode.Text] = fieldList;
                    }

                    string displayInfo = string.Format("[{0}] {1}", keyFieldTree.SelectedNode.Parent.Text,
                                                       GetFieldName(keyFieldTree.SelectedNode.Text));

                    FieldRelationSearchForm sForm = new FieldRelationSearchForm(conn, displayInfo, fieldValue, infoTable);
                    sForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请先选择要查找的字段!", "查找", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("字段值不能为空!", "查找", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
        /// <summary>
        /// 查找关联关系
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bSearch_Click(object sender, EventArgs e)
        {
            string fieldValue = searchFieldBox.Text;

            if (fieldValue != "")
            {
                if (keyFieldTree.SelectedNode != null && keyFieldTree.SelectedNode.Level == 1)
                {
                    Hashtable infoTable = new Hashtable();

                    foreach (Node tableNode in relationTree.Nodes)
                    {
                        List<string> fieldList = new List<string>();

                        foreach (Node fieldNode in tableNode.Nodes)
                        {
                            fieldList.Add(GetFieldName(fieldNode.Text));
                        }

                        infoTable[tableNode.Text] = fieldList;
                    }

                    string displayInfo = string.Format("[{0}] {1}", keyFieldTree.SelectedNode.Parent.Text,
                                                       GetFieldName(keyFieldTree.SelectedNode.Text));

                    FieldRelationSearchForm sForm = new FieldRelationSearchForm(conn, displayInfo, fieldValue, infoTable);
                    sForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("请先选择要查找的字段!", "查找", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }                
            }
            else
            {
                MessageBox.Show("字段值不能为空!", "查找", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }            
        }