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 March 6th, 2006, 06:46 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap 13 PAGE 514,515

Hi Guys,

I am using the example as a starting point for adding a record to a db and getting a id back for new record inserted.

I ran in to problems with Convert.ToInt32(cmd.ExecuteScalar()) not returning anything. heres a tip I fixed it by adding "SELECT @@IDENTITY AS 'Identity';" to the insert SQL statement. It now works :D

anyway back to the problem at hand.

I want to log if something goes wrong with the transaction but where do I declare tools?

The Tools.log is not declared and I cannot find where it is neither.

I am using VS.net 2005 Pro.

Cheers

 
Old October 5th, 2006, 05:38 AM
Registered User
 
Join Date: Aug 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I tried to play around with your select statement, but couldn't get it working. Could you please write it in full? cheers

 
Old October 13th, 2006, 08:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

ninjamonk,

It might be wiser to use scope_identity() rather than @@identity especially for a shopping cart. Consider the case where two customers are online and create an order at the same time. @@identity just returns the id of the latest row created in a table. The two customers could both get the same id as a result. scope_identity() makes sure that this doesn't happen.

So use SELECT SCOPE_IDENTITY() as 'Identity' instead.

There's more on this here http://discuss.fogcreek.com/dotnetqu...ow&ixPost=6315 but just googling for scope_identity and @@identity will return lots of pages about this issue.

I'll post again about the Tools question in a minute

Dan Maharry
Read the feed at http://feeds.feedburner.com/dansarchive
 
Old October 13th, 2006, 09:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 105
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to DanM
Default

ninjamonk,

The simplest way to get Tools working is to add Tools.vb from the FinalApplication folder for the book into your App_Code folder.

I'm not sure if it's an error in the book or just missing from the download but I'm sure you've noticed that in the End folder for Chapter 13 the calls to Tools.Log that are in the book aren't in the code.

Hope that helps, Dan

Dan Maharry
Read the feed at http://feeds.feedburner.com/dansarchive





Similar Threads
Thread Thread Starter Forum Replies Last Post
chap 16 Page 631 audreiev BOOK Beginning Linux Programming, 3rd Edition 0 July 7th, 2007 08:40 PM
Chap 8 - Try It Out Page 270 - 271 VB Deano252 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 May 30th, 2007 07:34 AM
Chap 19 Page 957 Lostincode BOOK: Ivor Horton's Beginning Visual C++ 2005 1 March 22nd, 2007 05:08 PM
Chap 3 , page 50 MacSr BOOK: Beginning VB.NET Databases 1 January 23rd, 2006 08:53 PM
Chap 13 ExampleServlet granola911 JSP Basics 0 October 20th, 2003 03:49 PM





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