Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2014, 01:44 PM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Cool Data Binding Error ch14 p491

Hello,

I keep getting this error even after going back and redoing it:

" Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList().
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList().

Source Error:


Line 17: select review;
Line 18: GridView1.DataSource = authorizedReviews;
Line 19: GridView1.DataBind();
Line 20: }
Line 21: }


Source File: c:\TestBegASPNET\WebSite1\Reviews\All.aspx.cs Line: 19 "

any Ideas?
 
Old October 14th, 2014, 05:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Are you using Visual Studio with the ASP.NET 4.5 version of the book? If so, take a look at this thread: Chapter 14 PlanetWrox.edmx

If not, can you tell me which version of the book and Visual Studio you're using?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 14th, 2014, 07:16 PM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Imar for the reply, I am using Visual Studio Express 2013 for Web and the book version I am using is Beginning ASP.NET 4.5.1.

Mohammed
 
Old October 15th, 2014, 01:49 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, in that case it looks like you missed the call to ToList on authorizedReviews:

GridView1.DataSource = authorizedReviews.ToList()

as shown on page 491 and the explanation at the end of that try it out.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 15th, 2014, 12:41 PM
Registered User
 
Join Date: Oct 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solved.... Thank you so much Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch14 Linq and EDO.net - ERROR leeWozyWarren BOOK: Beginning ASP.NET 4 : in C# and VB 4 November 29th, 2011 10:17 AM
Error when Binding data to a DataGridView Control nooij Visual Basic 2008 Essentials 0 April 30th, 2010 01:52 PM
Ch14;get Class not register error with Code Example clay5050 BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 5 December 23rd, 2009 07:17 AM
Crystal report binding with large data set, error lankark Crystal Reports 0 April 3rd, 2008 09:16 AM
"Cannot initialize data binding" error gbianchi Pro VB 6 7 May 11th, 2006 08:08 AM





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