Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 January 10th, 2007, 01:28 PM
Authorized User
 
Join Date: Mar 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your feedback.

Is there any work around for this? I have looked at the beer house code at there is times a SP only returns a couple fields and their doesn't seem to be any problem. For performance reasons it would be better if the SP only returned the exact information required.

 
Old January 11th, 2007, 04:43 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to vantoko
Default

can you post a sample of where beerhouse does that (don't know the code by heart :)
and the SP that is used ?

 
Old May 31st, 2007, 04:58 PM
Authorized User
 
Join Date: Jan 2007
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My problem was that the stored procedure, tbh_Articles_GetArticles, has a bug in it. The line that says "tbh_Articles.ReleaseDate AS RelDate" should actually be "tbh_Articles.ReleaseDate AS ReleaseDate". My reader was rightfully looking for something called "ReleaseDate" but the stored procedure named it "RelDate" instead. So I changed to what the reader was looking for (reader["ReleaseDate"]).

This happens in several stored procedures from the book (wherever Articles.ReleaseDate is selected).
 
Old May 31st, 2007, 06:15 PM
Authorized User
 
Join Date: May 2007
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello,

example with ImageUrl (if you have stored procedure that not retieve ImageUrl field for example you set exclude to true :


 protected virtual CategoryDetails GetCategoryFromReader(IDataReader reader, bool exclude)
      {

if(!exclude)
         return new CategoryDetails(
            (int)reader["CategoryID"],
            (DateTime)reader["AddedDate"],
            reader["AddedBy"].ToString(),
            reader["Title"].ToString(),
            (int)reader["Importance"],
            reader["Description"].ToString(),
            reader["ImageUrl"].ToString());
else
         return new CategoryDetails(
            (int)reader["CategoryID"],
            (DateTime)reader["AddedDate"],
            reader["AddedBy"].ToString(),
            reader["Title"].ToString(),
            (int)reader["Importance"],
            reader["Description"].ToString(),
            "";

      }


      protected virtual List<CategoryDetails> GetCategoryCollectionFromReader(IDataReader reader, bool exclude)
      {
         List<CategoryDetails> categories = new List<CategoryDetails>();
         while (reader.Read())
            categories.Add(GetCategoryFromReader(reader, exclude));
         return categories;


cheers






Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IndexOutOfRangeException dhoward VB.NET 2002/2003 Basics 4 February 20th, 2008 04:29 PM
Insert System date and System Time -Form _TextBox cnkumar74 VB How-To 14 February 14th, 2007 10:52 AM
System.IndexOutOfRangeException: - Please Help!!! olud ASP.NET 1.0 and 1.1 Basics 1 January 30th, 2007 02:56 PM
IndexOutOfRangeException - Chp 13, Page 446 aleahy BOOK: Beginning ASP.NET 1.0 1 November 5th, 2003 08:40 AM





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