public class LoginDAO
    {
       public int finduser(Employee employee)
          {
           DBconn app;
            string sql="";
            int purview = 0;
            SqlDataReader rs = null;
            try
            {
                app = new DBconn();
               
                sql = "select purview from employee where empid='" + employee.Empid + "' and password='" + employee.Password + "'";
                rs = app.getRS(sql);
                if (rs.Read())
                {
                    purview = rs.GetInt32(0);
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("reading");
                System.Console.WriteLine("error:" + ex.Message);
                System.Console.WriteLine("sql" + sql);            }
            finally
            {
                rs.Close();
            }
  
//每次一运行到finally这个地方就会弹出"未将对象引用设置到对象的实例".  我明明跟老师写的代码一样  为啥一运行就出错。         
             return purview;
           
       }
    }