Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 January 18th, 2006, 10:14 AM
Registered User
 
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wrox United Application Error Help

Hey all,

I keep running into a problem while trying to complete one of the exercises in the Beginning ASP.NET 2.0 book and I'm wondering if anyone here may have any input to help me out.

I'm working in Chapter 6 on the Indirect Events Try It Out exercise. This exercise has you load a page from the Wrox United website with a table listing all the team player names. You can then click on the "More Details" link to the right of each player name and another table showing that players details appears below.

Under this new table is a "Edit" link which once clicked allows you to change the details for that player. I can get to this point fine with no problems. However after I change a players details and press the "Update" link I get the following error:

Code:
Server Error in '/WroxUnited' Application.
Must declare the scalar variable "@original_PlayerID".
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.Data.SqlClient.SqlException: Must declare the scalar variable "@original_PlayerID".

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:

[SqlException (0x80131904): Must declare the scalar variable "@original_PlayerID".]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +493
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +915
   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179
   System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +1200
   System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +545
   System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +162
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
   System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +117
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +107
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +175
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838
I suppose the key part of the error is: Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@original_PlayerID".

I get this same error on both my laptop and my desktop computers. I've been able to do all the other exercises up until this point so I'm not quite sure what the problem is.

Any help anyone could provide would be much appreciated. Thanks in advance.

-Shannon
 
Old January 18th, 2006, 02:41 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 Shannon,

Look for a parameter called OldValuesParameterFormatString on your datasource control. It's probably set to original_{0}
Change it so simply {0) or simply remove it from the code entirely.

This parameter is used to control the way records are updated. In the beta version, this parameter had a default of original_{0}. That way, your stored procedures needed to accept each value twice; once with the new values (for example customerId) and once for the old value (e.g. original_customerId). Then inside the sproc, you could determine whether the underlying record had been changed and act accordingly.

In the RTM version, Microsoft simplified things a bit by leaving this out by default. Your code still has it, but if you run it against the RTM version you'll get the error you posted.

If you post more code in the future, can you please add a few line breaks here and there? Right now, I am typing this reply in a page that's about a meter wide.... ;)

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Erics Trip by Sonic Youth (Track 5 from the album: Daydream Nation) What's This?
 
Old January 19th, 2006, 07:05 AM
Wrox Author
 
Join Date: Jun 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shannon,
            Imar is completely right. Basically the app was compiled against a nearly final beta version of
the code and MS as usual made assurances that nothing would change in the final release, but of course they
did change. So some obsolete beta stuff got stuck in our code. We'll get a recompiled version up of the
application shortly. Another solution is to simply seek out the line "@original_PlayerID" and change it to
"@PlayerID". That should work just as well.

Chris

Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk
 
Old January 19th, 2006, 08:28 AM
Registered User
 
Join Date: Dec 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Guys,

Thanks for the help. Chris I did as you suggested and it worked like a charm! Imar thanks also for chiming in, I've only been of this site for a short time, and only posted one or questions but each time you've been a great help.

Now I can move onward and upward to Chapter 7! lol.

Thanks again guys.

PS - Imar I will be sure to add line breaks next time I post code. Thanks for the heads up.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrox United issues shanebbb BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 December 2nd, 2008 10:44 AM
Wrox United not working chris31martin BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 July 16th, 2008 09:00 AM
wrox united application - shopping cart durban BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 January 24th, 2007 10:21 AM
Wrox United - chapter 14 - error SqlDependency tom_10000001 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 November 10th, 2006 06:22 AM
Re: Wrox United Logo dotnet411 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 June 10th, 2006 09:46 AM





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