Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 6th, 2006, 06:46 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
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

  #2 (permalink)  
Old October 5th, 2006, 05:38 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
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

  #3 (permalink)  
Old October 13th, 2006, 08:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Banbury, , United Kingdom.
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
  #4 (permalink)  
Old October 13th, 2006, 09:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Banbury, , United Kingdom.
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:38 PM.


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