protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string sql = "select top 15 * from  Department ";


            SqlConnection myConnection = new SqlConnection(
             "Data Source=XIAOHUA;Initial Catalog=HRIS;User ID=sa");
            SqlDataAdapter myCommand = new SqlDataAdapter(sql, myConnection);
            DataSet ds = new DataSet();
            myCommand.Fill(ds, " Department");

            this.GridView1.DataSource = ds;
            this.GridView1.DataBind();

          
        }


protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
    {

 


        string sq = this.queryTree.SelectedNode.Value.ToString();
        string test = this.queryTree.SelectedNode.Value.ToString();

        string strinfo = " <B> 你现在查询的是部门编号为<B> " + sq + "<B> 的部门信息以及 " + sq + "  的子部门的信息</B>";
        this.Label1.Text = strinfo; 
       
      
                   //string sql = "select * from Department where EM_DeptCode like '%'+@EM_DeptCode+'%'";
             string sql = "select * from Department where
EM_DeptCode=@EM_DeptCode or parentID=@EM_DeptCode ";     //这里有两个条件:显示的值EM_DeptCode,parentID


             SqlConnection myConnection = new SqlConnection(
            "Data Source=XIAOHUA;Initial Catalog=HRIS;User ID=sa");
             myConnection.Open();
             SqlCommand com = new SqlCommand(sql, myConnection);
             SqlParameter par = new SqlParameter("@EM_DeptCode", SqlDbType.VarChar);
             par.Value = sq;
             com.Parameters.Add(par);

             SqlDataAdapter myCommand = new SqlDataAdapter(com);

             DataSet ds = new DataSet();
             myCommand.Fill(ds, "infq");

 

             this.gvQuery.DataSource = ds;
             this.gvQuery.DataBind();

       }