Why is she (C#) treating "dr" as an unassigned local variable? Or am I missing something?
Thank you.Code:natureofcollections n=new natureofcollections(); SqlDataReader dr; try { monkey.sql.sqlconnection.openconnection(cn); dr=new monkey.sql.sqlcommand("selectallnatureofcollections",cn).executereader(); while(dr.Read()) { n.add(new natureofcollection(dr[0].ToString(), dr[1].ToString(), dr[2].ToString())); } } catch(Exception ex) { MessageBox.Show(ex.Message); } finally { dr.Close(); monkey.sql.sqlconnection.closeconnection(cn); } return n;![]()




Reply With Quote