我已经解决,贴出来给大家参考参考
treeView1.Nodes.Clear();
TreeNode tnRoot = new TreeNode();
tnRoot.Text = "卡类型";
tnRoot.Tag = "";
treeView1.Nodes.Add(tnRoot);
if (null == conn1) conn1 = Login.getConnection();
string sql = "select * from cardtype";
OleDbCommand cmd = new OleDbCommand(sql, conn1);
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
TreeNode tmpNode = new TreeNode();
tmpNode.Tag = dr.GetValue(0);
tmpNode.Text = dr.GetString(1);
tnRoot.Nodes.Add(tmpNode);
}
treeView1.Update();
treeView1.ExpandAll();