Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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 March 20th, 2011, 12:26 PM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default Error with EntityDataSource

Hi Imar,

I'm getting another error on Try It Out pg 505.

I finished typing in the code, and I ran NewPhotoAlbum.aspx. I entered in a name for the photo album and click insert. I then get an error.

Here is the error:

Code:
Server Error in '/Site' Application.
--------------------------------------------------------------------------------

For the EntityDataSource, either Type or DbType (but not both) must be specified for each Parameter. 
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.InvalidOperationException: For the EntityDataSource, either Type or DbType (but not both) must be specified for each Parameter.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[InvalidOperationException: For the EntityDataSource, either Type or DbType (but not both) must be specified for each Parameter.]
   System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +738
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   System.Web.UI.WebControls.ListView.PerformSelect() +113
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
   System.Web.UI.WebControls.ListView.CreateChildControls() +55
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
I check back over my code but cannot see anything missing. any idea?

Regards

Last edited by TeaDrinkingGeek; March 20th, 2011 at 12:35 PM..
 
Old March 20th, 2011, 12:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It sounds as if your SelectParamater is missing the Type attribute as the error message suggests.

Can you please post your code when you create threads like these? Makes it easier to supply you with an answer on the first reply, rather than asking for the source code first ;-)

Cheers,

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 March 20th, 2011, 01:25 PM
Authorized User
 
Join Date: Feb 2011
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I've cheated and copied the code from Chapter 14 and compiled that.

It mean I missed a few exercises in the books, but it save on trying to work out what was happening.

I'm now going to read to the end of chapter 14 so I understand how it all ties together.

Thanks
Lee
 
Old March 20th, 2011, 01:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
but it save on trying to work out what was happening.
I think what you missed was the second half of step 4 on page 506, directly below Figure 14-13. The instructions read:

Quote:


Make sure you enter
it.PhotoAlbum.Id = @photoAlbumId in the Where Expression box at the top of the dialog. Next, click the Show Advanced Properties link and change the Type property of the parameter to Int32. When you’re done, click OK to dismiss the dialog box.

This adds the Type attribute to the SelectParameter.

Cheers,

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!
The Following User Says Thank You to Imar For This Useful Post:
TeaDrinkingGeek (March 20th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Questions about EntityDataSource and dynamic binding Rushino ASP.NET 4 General Discussion 4 November 22nd, 2010 09:58 AM
HTTP error 500: Internal Server Error in Load Testing sherin Visual Studio 2008 0 May 19th, 2010 09:02 AM
Remote Connection Error: Named Pipes Provider error hbansal ASP.NET 2.0 Basics 5 April 12th, 2009 09:51 AM
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM





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