On Thu, 2010-06-03 at 17:54 -0700, ds wrote:
> Can someone explain why this fails with a "System.ArgumentException:
> MemberAccess" exception:
> 
>     List<byte[]> document = (from d in db.DocumentBlobs
>         where d.DocumentBlobID == Request.QueryString["id"]
>         select d.Blob).ToList();
> 
> but why the following works just fine?
> 
>     string qs = Request.QueryString["id"];
> 
>     List<byte[]> document = (from d in db.DocumentBlobs
>         where d.DocumentBlobID == qs
>         select d.Blob).ToList();

This is because of the expression tree that the compiler creates.  The
former contains a MemberExpression (presumably for accessing the
Request.QueryString property), but ExpressionType.MemberAccess isn't
supported by SqlProvider.cs:GetLiteral():

            //case ExpressionType.MemberAccess:
            //    break;

The result is an exception.

I've filed this as:

        http://code.google.com/p/dblinq2007/issues/detail?id=260

 - Jon


-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to