Click here to Skip to main content
16,012,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir,

I have problem in retrieving connectionstring from app.config file. I use the code
c# code
C#
this.constring = ConfigurationManager.ConnectionStrings["CountryConstring"].ConnectionString;


HTML
//config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
  <connectionStrings>
    <clear/>
     <add name="sConstring"
     providerName="System.Data.SqlClient"
     connectionString="Data Source=Dnyan-PC;Initial Catalog=DB_REGISTRATION;Integrated Security=True" />
  </connectionStrings>

</configuration>

but above not work in .net4 for window application
please help if any

thanx,
[Email Removed]
dnyaneshwar

[Edit Notes]
Please do not put your email into your question like this as it is nothing more than an invitation for spam. When someone responds to your question you will get an email sent out to the address you signed up with.
Posted
Updated 10-Jan-12 9:12am
v4

Hi,

In your posted code, yo
1. in app.config file contains connection string name as "sConstring".
2. And in your cs file you retrieve with "CountryConstring".

can you more elaborate your question if i m wrong.
 
Share this answer
 
What does your app.config connection strings section look like? Add that to your question so that we have all the information we need to answer.

Use this as a template: http://msdn.microsoft.com/en-us/library/ms178411.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900