[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Configuration system failed to initialize

Posted on 2011-09-17
1
Medium Priority
?
604 Views
Last Modified: 2012-05-12
Hi I am trying to establish connection with server and encouter "Configuration system failed to initiaze at "ConnectionString = ConfigurationManager.AppSettings.Get("ConnectionString");"

"
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;

namespace Connections
{
    
    public partial class Form1 : System.Windows.Forms.Form 
    {
        private string ConnectionString;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
         
            ConnectionString = ConfigurationManager.AppSettings.Get("ConnectionString");
            SqlConnection con = new SqlConnection(this.ConnectionString);
            con.Open();
            MessageBox.Show(con.State.ToString());
            con.Close();
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Refresh();
           //ConnectionString = ConfigurationSettings.AppSettings.Get("ConnectionString");

        }
    }
}


///////////////////////////////////////////////////////////

<?xml version="1.0"?>
<configuration>
  
<configSections>  
</configSections>
  
<connectionStrings>
  <add name ="MaterialProdApp.Properties.Settings.CAMSConnectionString" connectionString="Data Source=TRamanah\SQLEXPRESS;Initial Catalog=CAMS;Persist Security Info=True;User ID=sa" providerName="System.Data.SqlClient" />
</connectionStrings>
  
<appSetting>
  <!-- Configure Sql Cennection String here-->
  <!--  Configure SQL Connection string here  -->
  <add key="LogErrorFile" value="ErrorLog.txt" />
  <add key="ProductionLine" value="A" />
  <add key="ConnectionString1" value="Data Source=172.16.93.252;Initial Catalog=CAMS;User ID=sa;Password=camssa;" />
  <add key="ConnectionString" value="Data Source=(local)\SQLEXPRESS;Initial Catalog=CAMS;User ID=sa;Password=abc123;" />
  <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSetting>
  
</configuration>

Open in new window

0
Comment
Question by:TITO2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
nishant joshi earned 2000 total points
ID: 36555530
try to use Properties.setting.Default.-----------
your connection string
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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

649 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