string str_Sql="select name ,bm from jddw_jbxx where jddw_jbxx.qzh in(select qzbs from "+database[1].ToString()+" where qzbs not in (select qzbs from "+ str_table +" group by qzbs))";
OracleDataAdapter MyCommand = new OracleDataAdapter(str_Sql,MyConn);
DataSet myds = new DataSet();
MyCommand.Fill(myds);
DataTable myTable = new DataTable();
myTable = myds.Tables[0];
if(myTable.Rows.Count>0)
{
for(int i=0;i<myTable.Rows.Count;i++)
{
TreeNode baby4=new TreeNode();
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes.Add(baby4);
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes[i+nodenum].Text=myTable.Rows[i]["name"].ToString().Trim();
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes[i+nodenum].ID=myTable.Rows[i]["bm"].ToString().Trim()+",9";
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes[i+nodenum].ExpandedImageUrl = "..\\..\\images\\TreeNodeOpen.gif";
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes[i+nodenum].ImageUrl = "..\\..\\images\\TreeNodeNormal.gif";
this.TreeView1.Nodes[0].Nodes[a1].Nodes[a2].Nodes[i+nodenum].NodeData = myTable.Rows[i]["bm"].ToString().Trim();
}
}
myTable=null;
myds=null;
MyCommand=null;

解决方案 »

  1.   

    在Application.EnableVisualStyles();
    的下面再加如下一个语句就可以了:Application.DoEvents();
      

  2.   

    http://community.csdn.net/Expert/topic/3718/3718139.xml?temp=.774563
      

  3.   

    hbxtlhx(踏雪寻岩) 
    我加了Application.DoEvents();这句可以了,为什么要这样加呢?
      

  4.   

    Application.DoEvents();是立即重绘winform
    参见
    http://msdn.microsoft.com/library/cht/default.asp?url=/library/CHT/cpref/html/frlrfsystemwindowsformsapplicationclassdoeventstopic.asp