p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=554)
-   -   Chapter 9 Object not Queryable (http://p2p.wrox.com/showthread.php?t=81812)

ja11946 December 5th, 2010 02:39 PM

Chapter 9 Object not Queryable
 
Hi all,

I am getting this error message: Expression of type 'Object' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.

I only get it on an existing project that I have. When I use another project with the exact syntax I don't get the error.

I have tried to look at the "add reference" and it seems like we are good to go there. Any suggestion are appreciated.

Here is the code, as outlined in the book. the "In movie" is generating the error.

Imports System.Collections.Generic
Imports System.Linq
Imports Microsoft.VisualBasic
Public Class FlashCards
Inherits System.Web.UI.Page


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

Dim movies = GetMovies()

Dim query = From m In movies _
Select m
Me.GridView1.DataSource = query
Me.GridView1.DataBind()
End If
End Sub

ja11946 December 5th, 2010 03:20 PM

Fixed it
 
Option infer was turned off, I turn it on, now all is good.
Thanks


All times are GMT -4. The time now is 06:57 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.