Wrox Programmer Forums
|
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
 
Old August 9th, 2009, 11:25 AM
Registered User
 
Join Date: Aug 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need help about DbHelper class.

In method GetHRPaidTimeOffConnectionString(),

I can't use ConfigurationManager class to get connection string in web.config because it doesn't appear in ItelliSense.

When I copy DBHelper.cs file in source code of this book to Framework folder and press Ctrl + F5 to run project,

one error come up:

"The name 'ConfigurationManager' does not exist in the current context."

I think ConfigurationManager class can be accessed in PaidTimeOffUI not DAL layer, right?

What can I do to slove this problem?

Here is DBHelper class:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace V2.PaidTimeOffDAL.Framework
{
    public class DBHelper
    {
        private const string HRPAIDTIMEOFF_CONNSTRING_KEY = "HRPaidTimeOffConnString";

        public static string GetHRPaidTimeOffConnectionString()
        {
            return ConfigurationManager.ConnectionString[HRPAIDTIMEOFF_CONNSTRING_KEY].ConnectionString;
        }
    }
}
 
Old August 10th, 2009, 04:56 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

You need to add a reference to System.Configuration to the V2.PaidTimeOffDAL.

Right Click the V2.PaidTimeOffDAL project, Select Add Reference, under .NET tab add System.Configuration.

the using should now be recognized.

Ronnie
The Following User Says Thank You to kalel_4444 For This Useful Post:
DungPT (August 10th, 2009)
 
Old August 10th, 2009, 05:56 AM
Registered User
 
Join Date: Aug 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default That worked!

Hi Ronnie,

Thank for kindly reply, that is the stupid error!

It works perfectly now.

Thanks again.





Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Class disappears in the class panel hint2310 Visual C++ 0 September 18th, 2004 03:46 PM
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.