Wrox Programmer Forums
|
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 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 December 2nd, 2015, 01:27 PM
Registered User
 
Join Date: Oct 2014
Posts: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Default Chap 17 Code1 Books Not saving

All,

I have not seen this problem from anyone else, or errata on the problem so I'm entering it here for anyone who is trying to get the code working.

In Code1 the Books.cs file seems to have been copied from a more advanced version of the code that allows for more data to be collected such as "Price" and "Publisher". However, the table in the database doesn't support those values; only "Title" and "Author". To correct the Books.cs file so that it will save updates made in the table, make the following changes:

1. Do a search for all instances of "Price" and "Publisher" and remove them, (don't forget to remove commas that are associated with these values along with any other identifiers such as "string"). In the ExecuteCommand function there are additional lines of code associated with these values that should also be removed. If you wish, you can just rem them out if your not sure which lines to keep and which to get rid of; though it should be fairly obvious.

2. Locate all instances of "AuthorID" and change them to "Author". In addition change the "int" identifier for "Author" to "string" as this is not an integer value. There is one location, in the ExecuteCommand function where "SqlDbType.int" should be changed to "SqlDbType.VarChar" as SQL doesn't use "string".

3. In ExecuteCommand, There are two references to SqlParameters (an array) an they are being established as a size of 4 and 5. These need to be reduced by two since you are no longer trying to send "Price" and "Publisher".

That's all you should need to do. Run the web page and you should now be able to Edit the data and perform an Update. Let me know if this still doesn't work or you're having other problems.

Mark





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 17 Code1 CustomTable error mbedell1@msn.com BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 December 2nd, 2015 01:02 PM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 17th, 2009 08:57 AM
Chap 17: Email not working tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 0 August 15th, 2009 09:09 AM
Chap 17 error: only content controls... Torq BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 September 8th, 2007 10:03 AM
Chap 17, page 609, error -- stumped HartfordDeveloper BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 December 8th, 2005 11:52 PM





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