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 February 10th, 2006, 07:23 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9 Try It Out Error, page 325

The Looping and Making Decisions Try It Out, Line 5, asks you Save the files and run.

If you get an error (Invalid cast exception ...) on code line:

GoalsFor += Convert.ToInt32(rdr("GoalsFor"))

it is because the database table Fixtures contains a record for the BuyChester United team with NULL values in the goalsfor and goals against fields. (A try-catch block could have caught this.)

To fix this: Use the Database explorer to navigate to the WroxUnited.mdf database tables, right click the Fixtures table and select Show Table Data. When the table displays, you can manually enter non-NULL values. The \End\Chapter09 shows values: GoalsFor = 1 and GoalsAgainst = 2 and you should replace the NULLs with those if you want to exactly duplicate the results shown in Figure 9-8.

VV

 
Old February 13th, 2006, 12:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You could also use IIF to check if null, then return 0; otherwise return the integer value.

Brian
 
Old February 13th, 2006, 01:21 PM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian:
Thanks.
Yes you are right. I thought correcting the missing data in the database would be a more appropriate fixup than adding code to proceed without throwing the exception.
But Thanks
VV


 
Old March 22nd, 2006, 02:22 PM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to harrison4411
Default

The data is Read Only. You need an Update command.

How To:
- After you open the database table Fixtures
- Change Type to Update
- Make changes to GoalsFor and Goals Against
- Move record pointer to another row. This writes the data.

or
- Change Type is Update
- past this code into the "Show Sql Pane"
UPDATE Fixtures
SET GoalsFor = 1, GoalsAgainst = 2
WHERE (FixtureID = 10)

and selct the Execute icon (exclamation)

Result will show 1 Row affected by last query






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Chapter 3 (try it out) page 85 dea0303 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 August 29th, 2006 05:47 PM
Error in code Chapter 13 Page 516 neubauet BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 9 June 11th, 2006 11:06 AM
Chapter 10, Try It Out error, page 380 VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 February 13th, 2006 12:41 PM
error codes, Chapter 8, Page 218 JohnAlden BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 June 19th, 2004 11:02 AM
Chapter 15 page 662 error lance BOOK: Beginning ASP 3.0 0 February 12th, 2004 08:56 PM





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