Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.net C Sharp error

Posted on 2012-03-23
3
Medium Priority
?
498 Views
Last Modified: 2012-03-30
Hi on the line starting '   sqlConn.ConnectionString = ConfigurationManager
I am getting the error "The name ConfigurationManager does not exist in the current contect

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Data.Sql;

namespace CRM_GHB
{
    public partial class Contacts : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void DisplayContacts()
        {
            System.Data.SqlClient.SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection();
            sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings("GHBCRM_TSTConnectionString").ConnectionString;

            try
            {
                sqlConn.Open();
            }
            catch (Exception ex)
            {
                Interaction.MsgBox(ex.Message, "connection failed");
            }
0
Comment
Question by:Murray Brown
3 Comments
 
LVL 18

Accepted Solution

by:
Gary Davis earned 1000 total points
ID: 37757157
You need to Add Reference for System.Configuration.

Gary Davis
0
 
LVL 5

Assisted Solution

by:Vishal Kedar
Vishal Kedar earned 1000 total points
ID: 37770183
You need to reference System.Configuration.dll in your project as well as the "using" statement.

Namespaces are (sometimes) "split" across assemblies. That means that types in a single namespace are actually in different assemblies.

To determine which assembly a BCL or FCL type is in, look it up on MSDN. If you look at the help for ConfigurationManager, you'll see that it specifies that it's in the System.Configuration assembly by looking near the top at "Assembly". This is the assembly you need to reference from your project
0
 

Author Closing Comment

by:Murray Brown
ID: 37786415
Thanks very much
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question