protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) { TreeNode node = this.TreeView1.SelectedNode; if (node.Depth == 3) { if (node.Parent.Value.Equals("t")) { this.labProperies.Text = "表属性"; this.RepeaterKeys.Visible = true; this.RepeaterColumns.Visible = true; this.RepeaterIndexes.Visible = true; this.RepeaterParameters.Visible = false; this.RepeaterFunPara.Visible = false; this.RepeaterProperies.DataSource = getInfos.GetTableProperties(node.Parent.Parent.Text, node.Text); this.RepeaterProperies.DataBind(); this.RepeaterColumns.DataSource = getInfos.getTableClomns(node.Parent.Parent.Text, node.Text); this.RepeaterColumns.DataBind(); DataTable dt = getInfos.getTableKeys(node.Parent.Parent.Text, node.Text); if (dt.Rows.Count > 0) { this.RepeaterKeys.DataSource = dt; this.RepeaterKeys.DataBind(); } else { this.RepeaterKeys.Visible = false; } dt = getInfos.getTableIndex(node.Parent.Parent.Text, node.Text); if (dt.Rows.Count > 0) { this.RepeaterIndexes.DataSource = dt; this.RepeaterIndexes.DataBind(); } else { this.RepeaterIndexes.Visible = false; } strScript = getInfos.getTableScript(node.Parent.Parent.Text, node.Text);//.Replace("\r\n", "<br/>").Replace("\t", " ").Replace(" ", " "); } else if (node.Parent.Value.Equals("v")) { this.RepeaterKeys.Visible = false; this.RepeaterColumns.Visible = true; this.RepeaterIndexes.Visible = true; this.RepeaterParameters.Visible = false; this.RepeaterFunPara.Visible = false; this.labProperies.Text = "视图属性"; this.RepeaterProperies.DataSource = getInfos.GetViewProperties(node.Parent.Parent.Text, node.Text); this.RepeaterProperies.DataBind(); this.RepeaterColumns.DataSource = getInfos.getViewColmns(node.Parent.Parent.Text, node.Text); this.RepeaterColumns.DataBind(); DataTable dt = getInfos.getViewIndex(node.Parent.Parent.Text, node.Text); if (dt.Rows.Count > 0) { this.RepeaterIndexes.DataSource = dt; this.RepeaterIndexes.DataBind(); } else { this.RepeaterIndexes.Visible = false; } strScript = getInfos.getViewScript(node.Parent.Parent.Text, node.Text);//).Replace("\r\n\r\n", "<br/>").Replace("\r\n", "<br/>").Replace("\t", " ").Replace(" ", " "); } else if (node.Parent.Value.Equals("p")) { this.RepeaterColumns.Visible = false; this.RepeaterIndexes.Visible = false; this.RepeaterKeys.Visible = false; this.RepeaterFunPara.Visible = false; RepeaterParameters.Visible = true; this.labProperies.Text = "存储过程属性"; this.RepeaterProperies.DataSource = getInfos.GetProcedureProperties(node.Parent.Parent.Text, node.Text); this.RepeaterProperies.DataBind(); DataTable dt = getInfos.getProcedureParamters(node.Parent.Parent.Text, node.Text); if (dt.Rows.Count > 0) { this.RepeaterParameters.DataSource = dt; this.RepeaterParameters.DataBind(); } else { this.RepeaterParameters.Visible = false; } strScript = getInfos.getProcedureScript(node.Parent.Parent.Text, node.Text);//).Replace("\r\n\r\n", "<br/>").Replace("\r\n", "<br/>").Replace("\t", " ").Replace(" ", " "); } else if (node.Parent.Value.Equals("f")) { this.RepeaterColumns.Visible = false; this.RepeaterIndexes.Visible = false; this.RepeaterKeys.Visible = false; this.RepeaterParameters.Visible = false; this.RepeaterFunPara.Visible = true; this.labProperies.Text = "存储过程属性"; this.RepeaterProperies.DataSource = getInfos.getFunctionProperties(node.Parent.Parent.Text, node.Text); this.RepeaterProperies.DataBind(); DataTable dt = getInfos.getFunctionParameters(node.Parent.Parent.Text, node.Text); if (dt.Rows.Count > 0) { this.RepeaterFunPara.DataSource = dt; this.RepeaterFunPara.DataBind(); } else { this.RepeaterFunPara.Visible = false; } strScript = getInfos.getFunctionScript(node.Parent.Parent.Text, node.Text);//).Replace("\r\n\r\n", "<br/>").Replace("\r\n", "<br/>").Replace("\t", " ").Replace(" ", " "); } this.Literal1.Text = "<pre name='code' class='brush: sql;'>" + strScript + "</pre>"; } }