有这么一段代码,当执行while循环时,循环执行一次后在"while(TempDr.Read())"处报一个错误:Invalid operation. The OracleDataReader is closed. 这是为什么啊??sql = "select s.inst_id,s.inst_name,t.lsparent from pmis.pm_om_insts s ,PM_PD_DEPS t where t.lsparent = 176 and s.inst_id=t.inst_id  order by s.inst_dsp_idx";
Conn.Close();
Conn.Open();
OracleCommand TempCom = new OracleCommand(sql,Conn);
OracleDataReader TempDr = TempCom.ExecuteReader();
try
while(TempDr.Read())
{
string strId = TempDr["lsparent"].ToString();
string instid = TempDr["inst_id"].ToString();
GetParentNode(TreeView1.Nodes,strId);//自己定义的函数
string sql1 = "select inst_id,inst_name from pmis.pm_om_insts where inst_id={0}";
sql1 = string.Format(sql1,instid);
InitNode(ParentNode,sql1);//自己定义的函数
}
}
finally
{
//Conn.Close();
}