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
|