Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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 August 5th, 2007, 02:18 AM
Registered User
 
Join Date: Jun 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch1, why using CollectionBase class?

Hi,

 I purchased this great book and I must say it's one of the best books around. Although it could be better by explaining the complete solution step-by-step but I guess it's not for beginners.

In Chapter 1 I saw the authors using the CollectionBase class, why? can't we just use the Generic classes?

one more issue: the stored procedure
CREATE PROC InsertDiaryEntry
(
    @DiaryId INT,
    @EntryDate DATETIME,
    @EntryTitle NVARCHAR(50),
    @EntryText NVARCHAR(2000),
    @NewDiaryEntryId BIGINT = -1 OUTPUT
)
AS
INSERT INTO DiaryEntry (DiaryId, EntryDate, EntryTitle, EntryText)
VALUES(@DiaryId, @EntryDate, @EntryTitle, @EntryText)
RETURN @@IDENTITY

Uses OUTPUT parameter to set the value of @NewDiaryEntryId and also return the same value I don't understand why the authors did that?
Help please

 
Old August 5th, 2007, 04:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

One of the goals of the book is to show different ways to accomplish things. While generic classes are extremely useful in most scenarios, there are also situations where it makes sense to create your own collection class. This is shown with the ContactCollection class. However, the code would have worked equally well with a List (Of Contact) generics list or another generic collection.

With regards to the procedure, I think it's a bug. I didn't write that chapter, so I am not 100% sure about the reasoning behind the code, but as far as I can tell, you can drop the OUTPUT param. E.g. the following (untested) should work as well:

SPROC

 @EntryText NVARCHAR(2000)<s>,
    @NewDiaryEntryId BIGINT = -1 OUTPUT</s>
)

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old August 5th, 2007, 05:34 AM
Registered User
 
Join Date: Jun 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Imar,

Thanks for your help. I will try to use Generics later.

 
Old August 5th, 2007, 06:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, later chapters (WebShop, BugBase and others) use Generics a lot more.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible Error? - CH1 Regiser.php ArthurDent BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 2 August 12th, 2008 02:50 AM
Ch1 MySQL returns Error 1046: No database selected aiche_ag BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 October 1st, 2007 02:47 PM
Property access from Class within Partial Class zoltac007 C# 2005 0 December 1st, 2006 01:01 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM





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