textBox1.Enabled=false;
treeView2.ShowLines=false;
treeView2.ImageList=imageList1;
string strcon="workstation id=.;packet size=4096;integrated security=SSPI;data source=.;persist security info=False;initial catalog=zhb";
SqlConnection con = new SqlConnection(strcon);
con.Open();
SqlCommand com = new SqlCommand("select * from goods",con);
SqlDataReader dr = com.ExecuteReader();
TreeNode newNode1 = treeView2.Nodes.Add("TreeView第一极");
while(dr.Read())
{
treeView2.ImageIndex=0;//没有选择前图片显示为索引0的图片
treeView2.SelectedImageIndex=1;//选择后图片显示为索引1的图片
TreeNode newNode12 = new TreeNode(dr[1].ToString());
newNode12.Nodes.Add("语文成绩:"+dr[2].ToString());
newNode12.Nodes.Add("英语成绩:"+dr[3].ToString());
newNode12.Nodes.Add("学号:"+dr[4].ToString());
newNode12.Nodes.Add("总成绩:"+(Convert.ToInt32(dr[2].ToString())+Convert.ToInt32(dr[3].ToString())));
newNode1.Nodes.Add(newNode12);
}