views:

174

answers:

1

Hi, I have a simple linq statement that isn't quite returning what I would like. I understand why, I just don't know how to wriet it to get what I want. The query is as follows:

answers = from a in ents.tblCalls
                          where a.tblSessions.tblUsers.UserID == UserID.Value
                          && (a.StartTime >= startdate.Value && a.StartTime <= enddate.Value)
                          select a.tblAnswers.Where(p => p.tblAnswerTypes.AnswerType ==
                              "Yes" && p.tblQuestions.tblQuestionTypes.QuestionType == "Sell In");

This is giving me a return type of IQueryable< IEnumerable < tblAnswers >>, whereas all I really want is the IQueryable < tblAnswers > so that I can work with them later easily.

Thanks guys!

+1  A: 
public IQueryable<tblAnswers> ConcatenateResult
       (IQueryable<IEnumerable<tblAnswers>> answers) 

    newAnswers = List<tblAnswers>();
    for (i = 0, i < answers.Count() , i++)
    {
        newAnswers.AddRange(answers[i])
    }

    return newAnswers.AsQueryable()
}

Kindness,

Dan

Daniel Elliott
Not sure where to insert that.IQueryable QAnswers;QAnswers = answers.AsQueryable() throws an error - cannot convert IQueryable<IEnumerable<tblAnswers>> to IQueryable<tblAnswers>
Sergio
Re-read your question and edited answer ... best of luck
Daniel Elliott
thank you my good man
Sergio