score:2

Accepted answer

that executes the same query 4 or 5 separate times, although connection pooling will reuse a single connection. should be

var query = from e in ctx.bio_employee.where(x => x.emp_id == emp_id)
             select new
             {
                  ta.ta_system
                 ,ta.bio_consent_flag
                 ,e.bio_consentform_rid
             };

var result = query.firstordefault();

if (result != null) 
{
    vm.tasystem = result .ta_system;
    vm.bio_consent_flag = result .bio_consent_flag == null ? "n" : result .bio_consent_flag.trim().toupper();
    vm.employee_bio_consentform_rid = result.bio_consentform_rid;
}

Related Query

More Query from same tag