Subsonic 3 - Sequence contains no matching element

Posted by bastos.sergio on Stack Overflow See other posts from Stack Overflow or by bastos.sergio
Published on 2010-06-01T17:58:53Z Indexed on 2010/06/01 20:03 UTC
Read the original article Hit count: 469

Filed under:
|

I need help creating a LINQ SQL with subsonic. First the basics, this works fine:

var query = (from o in bd.concelhos
                     orderby o.descricao
                     select o);

        var results = query.ToList<concelhos>();

However, I want to filter out some columns and I have created the following code:

var query = (from o in bd.concelhos
                     orderby o.descricao
                     select new FilteredConcelhos { id = o.idDistrito + "/" + o.idConcelho, descricao = o.descricao });

        var results = query.ToList<FilteredConcelhos>();

which errors out in the ToList method with the description "Sequence contains no matching element"

Any help would be great with this...

© Stack Overflow or respective owner

Related posts about subsonic

Related posts about 3