Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution 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 17th, 2003, 12:20 PM
Registered User
 
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error on Page 153?

I love the book, but I have a question about page 153.

The tables primary id is just the UserID, How would it know to generate a 2601 on the email address? How does it know?
Thanks,
Tim





try
{

RunProcedure("sp_Accounts_CreateUser", parameters, out rowsAffected);

}
  catch ( SqlException e )

{
// 2601 is the number returned when the primary key
// is violated. We know if we're violating the primary
// key that the e-mail address is already on file.
// Its cheaper than actually searching for that address before
// inserting.
    if (e.Number == 2601)
       {
return (int)Wrox.WebModules.Accounts.ProcResultCodes.Acco untAlreadyOnFile;
 }
    else
   {

   throw new AppException("An error occurred while executing the Accounts_CreateUser stored procedure",
  e );
    }
  }

Tim Kelley
 
Old December 17th, 2003, 12:46 PM
Authorized User
 
Join Date: Nov 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yep, it's a mistake. There ought to be a unique index on the email column, in which case the 2601 will occur.
(Error 2601 is "Cannot insert duplicate key row.."
 Error 2627 is "Violation of PRIMARY KEY constraint..")

brian smith

brian
 
Old December 22nd, 2003, 10:02 PM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As far as I know that this error message corresponds to the error message returned from sql when the stored procedures are executed.

Thanks
Musa








Similar Threads
Thread Thread Starter Forum Replies Last Post
Error page youyou_hym Dreamweaver (all versions) 1 June 2nd, 2005 03:59 PM
CH 5 Page 153 zamankazi BOOK: ASP.NET Website Programming Problem-Design-Solution 8 November 4th, 2004 08:38 AM
Error Page qazi_nomi Classic ASP Basics 1 August 20th, 2004 05:49 AM
Phile Page error, visual studio error reps BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 27th, 2003 10:11 AM





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