getting the connectionstring from app.config

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>
 
H

Herfried K. Wagner [MVP]

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'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top