public cjbzsz()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
LinkDataBase link = new LinkDataBase();
string sendTableName1 = "cjtb";
string sendStrSQL1 = "SELECT * from cjtb";
this.ds1 = link.SelectDataSet(sendStrSQL1, sendTableName1);
this.myTable1 = ds1.Tables[0];
for (int i = 0; i < myTable1.Rows.Count; i++)
{
this.myRow1 = myTable1.Rows[i];
TreeNode tn = new TreeNode();
tn.Text = myRow1[1].ToString();
tn.ImageIndex = 1;
tn.SelectedImageIndex = 2;
tv.Nodes[0].Nodes.Add((TreeNode)(tn.Clone()));
string sendTableName2 = "bztb";
string sendStrSQL2 = "SELECT * from bztb";
this.ds2 = link.SelectDataSet(sendStrSQL2, sendTableName2);
this.myTable2 = ds2.Tables[0];
int k = 0;
for (int j = 0; j < myTable2.Rows.Count; j++)
{
this.myRow2 = myTable2.Rows[j];
k++;
if (myRow2[1].Equals(myRow1[1]))
{
TreeNode tn0 = new TreeNode();
tn.Text = myRow2[2].ToString();
tn.ImageIndex = 2;
tn.SelectedImageIndex = 3;
tv.Nodes[0].Nodes[k].Nodes.Add((TreeNode)(tn0.Clone()));
}
}
}
我要在系统初始化的时候,从数据库中读去数据建一个树,其中,数据库分别是红色标志的,请问为什么在初始化的时候不能够建立下一级的树啊.