『原创』C#中TreeView类操作全攻略:建立树,新增节点,删除节点,修改节点,拖动节点,与Oracle数据库交互操作(一)(17) /// 查询数字字典中功能类别的内容;并把查询结构保存在ClientDictionary对象DIC_funcType中; /// </summary> /// <param name=""></param> /// <returns></returns> private void QueryFuncTypeDictionary() { funcTableConn.Open (); OracleCommand mySelectCmd= new OracleCommand(); mySelectCmd.Connection = funcTableConn; mySelectCmd.CommandText = "select * from 数据字典,属性 where 数据字典.属性ID = 属性.属性ID and 属性.属性名称 = '功能类别'"; mySelectCmd.CommandType = CommandType.Text ; try { OracleDataReader myReader = mySelectCmd.ExecuteReader(); int dicCount=0; if (myReader.HasRows) { while (myReader.Read()) { dicCount++; } } myReader.Close(); myReader = mySelectCmd.ExecuteReader(); DIC_funcType=new ClientDictionary[dicCount]; for(int i=0;i<dicCount;i++) { myReader.Read(); DIC_funcType[i]=new ClientDictionary(myReader.GetString(4),myReader.GetString(3)); } myReader.Close(); } catch(Exception ex) { MessageBox.Show("查询数据字典时出现错误:"+ex.ToString()); } finally { funcTableConn.Close ( ) ; } }
/// <summary> /// 将数据添加到TreeView控件中