treeView绑定问题(急)
我将treeview和数据库已经绑定,但是我需要一个效果.单击树控件中的节点,将对应的数值绑定到textbox中等输入文本控件中.public void GetText(string strId)
{
string cmd = "select * from FD_CadSet where cCadID='"+strId+"'";
SqlConnection _Connection = new SqlConnection(SqlConn);
_Connection.Open();
SqlCommand com = new SqlCommand(cmd, _Connection);
SqlDataReader dr = com.ExecuteReader();
while (dr.Read())
{
this.txb_code.Text = dr[1].ToString();
this.nu_week.Value = int.Parse(dr[6].ToString());
this.tb_date.Text = dr[3].ToString(); //日期
this.nu_day.Value = int.Parse(dr[2].ToString());
this.tbx_bz.Text = dr[3].ToString();
}
dr.Close();
_Connection.Close();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
GetText(treeView1.SelectedNode.Text.Substring(2)); //单击绑定
}
就是这样,却怎么也达不到效果.