Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 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
  #1 (permalink)  
Old August 28th, 2009, 03:19 PM
Registered User
 
Join Date: Oct 2007
Location: Evansville, Indiana, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default DBHelper Class ??

This is probably a dumb question from a beginner but I will ask it anyway.

Where did the DBHelper Class come from? It is not in the source code from Chapter 2 but does show up in the source for Chapter 3. I have scanned the book and cannot find it mentioned in the text (and only in code) on page 162 in Chapter 6.

Did I miss something somewhere? Is this a class that created automatically or in what Chapter does it discuss creating this class and why?

Thanks for your tolerance.
  #2 (permalink)  
Old August 30th, 2009, 11:26 PM
Registered User
 
Join Date: Aug 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,

You are right. DBHelper class is not mentioned in the text of this book. But this bug is noticed by Varallo on page 44. So you can download the code(include DBHelper class) for Chapter 2 (Revised 4/1/09) now.

By default, HRPaidTimeOff application uses connection string in settings file of DAL, but you should use DBHelper class to get connection string in web.config file instead.

- Using HRPaidTimeOffDataContext's default constructor may be causing some errors because when you drag tables or stored procedures to the ORM Designer, the connection string in settings file may be changed or something like that.

In some case, HRpaidTimeOffConnectionString1 is added automatically to settings file. So you can get errors when settings file uses HRpaidTimeOffConnectionString1, but HRPaidTimeOff.designer.cs still uses HRpaidTimeOffConnectionString, for example.

Code:
using(HRPaidTimeOffDatacontext db = new HRPaidTimeOffDataContext())
See more in this link:

Login failed for database user

- Using DBHelper class is easy to manage, you can edit the connection strings in IIS, for example.

Code:
using(HRPaidTimeOffDatacontext db = new HRPaidTimeOffDataContext(DBHelper.GetHRPaidTimeOffConnectionString()))
Check this link (If you need):

Need help about DbHelper class.

---------------------

Hope this help.

Thanks.

Last edited by DungPT; September 1st, 2009 at 01:24 AM..


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help about DbHelper class. DungPT BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 August 10th, 2009 05:56 AM
Using logging class as a static class punitw General .NET 0 August 14th, 2008 03:03 AM
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.