Beispiel #1
0
        private void 刷新ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtWhereStr.Text))
            {
                whereString = "Where " + txtWhereStr.Text.Trim();
            }
            else
            {
                whereString = "";
            }

            txtScript.Text = "";

            if (treeView.SelectedNode != null)
            {
                if (treeView.SelectedNode.Level == 2)
                {
                    statusString = "正在查询...";
                    SetParentInfo.SetStatusString(mainForm, statusString);

                    string dbName    = treeView.SelectedNode.Parent.Text;
                    string tableName = treeView.SelectedNode.Text;
                    txtScript.Text = getInsertScript(dbName, tableName);

                    SetParentInfo.SetStatusString(mainForm, statusString);
                }
            }
            else
            {
                MessageBox.Show("未连接数据库");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 选中事件
        /// </summary>
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            txtWhereStr.Text = "";
            whereString      = "";
            if (treeView.SelectedNode != null && treeView.SelectedNode.Level == 2)
            {
                生成清库语句ToolStripMenuItem.Enabled = false;
                try
                {
                    txtScript.Clear();
                    statusString = "正在查询...";
                    SetParentInfo.SetStatusString(mainForm, statusString);

                    string dbName    = treeView.SelectedNode.Parent.Text;
                    string tableName = treeView.SelectedNode.Text;

                    txtScript.Text = getInsertScript(dbName, tableName);

                    SetParentInfo.SetStatusString(mainForm, statusString);
                }
                finally
                {
                    GC.Collect();
                }
            }
            else if (treeView.SelectedNode != null && treeView.SelectedNode.Level == 1)
            {
                生成清库语句ToolStripMenuItem.Enabled = true;
            }
            else
            {
                生成清库语句ToolStripMenuItem.Enabled = false;
            }
        }