getting the connectionstring from app.config

  • Thread starter Thread starter Robert Smith
  • Start date Start date
R

Robert Smith

Hi, I have a windows forms c#.net app and I want to get the connection string
from my app.config file which is shown below:

how do I achieve this

Thanx in advance
Robert

<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DataAccess.Properties.Settings.MARSConnectionString"
connectionString="Data Source=LON-OXBRD01;Initial
Catalog=MARS;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
 
Robert Smith said:
Hi, I have a windows forms c#.net app and I want to get the connection
string
from my app.config file which is shown below:

<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DataAccess.Properties.Settings.MARSConnectionString"
connectionString="Data Source=LON-OXBRD01;Initial
Catalog=MARS;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

'Properties.Settings.Default.MARSConnectionString'.
 
Back
Top