Click here to Skip to main content
15,923,083 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi , this is my connection string , I have tried to get connection using Sysstem.Configuration.



XML
var myConnectionString = ConfigurationManager.ConnectionStrings["YourConnectionStringName"].ConnectionString;
<pre lang="xml">&lt;connectionStrings&gt;
  &lt;add name=&quot;MyContext&quot; connectionString=&quot;DataSource=|DataDirectory|database.db&quot; providerName=&quot;System.Data.SqlServerCe.4.0&quot;/&gt;
&lt;/connectionStrings&gt;</pre>


but it wont works can u guide me or send any snippets
Posted
Comments
Sergey Alexandrovich Kryukov 24-Dec-13 12:47pm    
How a connection string can be related to WPF? You really need to embrace the idea of separate of concerns.
—SA
kingsa 24-Dec-13 22:27pm    
then how to accesses globally my connection string as like in wpf
Sergey Alexandrovich Kryukov 25-Dec-13 0:14am    
Not clear. What do you mean "as like in WPF"? There is nothing "global" in WPF. See where you define the connection string and use it.
—SA

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