Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Load not there

I am using EF and I have the following code in which I am trying to get rows from a view called interface5toSSHIP. The SQL Explorer reveals that the database view has one row right now. The following query doesn't seem to return it. What am I doing wrong?

IEnumerable<interface5toSSHIP> i5;
            using (RREM_GilbaneEntities3 entities3 = new RREM_GilbaneEntities3())
            {
                i5 = from i in entities3.interface5toSSHIP
                select i;
            }

Then I get the title error when I attempt to DataBind it:

grdvwInterface5ReadyToSend.DataSource = i5;
            grdvwInterface5ReadyToSend.AllowPaging = true;
            grdvwInterface5ReadyToSend.AllowSorting = true;
            grdvwInterface5ReadyToSend.DataBind();

The problem is I can't find how to do the Load. I looked up an example like this:

IntranetModelContainer db = new IntranetModelContainer();
      db.Entities.OfType<Employee>().Load();
      return db.Entities.Local.OfType<Employee>();

I added a reference to System.Data.Entity and I can't find a .Entities off my entities3 or a LOad method. How do I do this?

Answers


I solved it by calling the ToList() method on it.


ToList() can be too slow, because it will try to get all properties (get{}) and resolve another objects related to it. A fast way can be:

yourLinq.AsQueryable()

Need Your Help

jQuery is automatically escaping ajax

php jquery ajax post escaping

I'm using jQuery to check to see if a username is taken. My issue is that $.post seems to escape anything. For example, I use this:

Unable to print with many PrintDataGrid in flex

flex printing

I have a title window with 3 datagrids in it and I have to add print functionality.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.