Search code examples
linqdatasource

The name xxx does not exist in the current context. What am I doing wrong?


 var result = from lr in _db.LeaveRequest
                 join th in _db.TotalHourslu    
                 on lr.TotalHoursEffect 
                 equals th.Minutesselect
                     select new { lr.TotalHoursEffect, th.Minutes, tr.Display };

ERROR: The name '_db' does not exist in the current context The name '_db' does not exist in the current context The name ' tr ' does not exist in the current context


Solution

  • Did you forget to add

    MyDataClassesDataContext _db = new MyDataClassesDataContext();
    

    to your class as a member variable?