Web.Config - retrieving DB connection strings held in specific section

G

Griff

Hi

Bit confused about how to read a connection string from my web.config...I
need to hold this data in a particular section (v2.0 specific).

Extract from web.config:
-------------------------------------
<configuration>

<configSections>
<sectionGroup name="OurCompanyName">
<section name="OurApplicationName"
type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>

<OurCompanyName>
<OurApplicationName>
<add
name="OurDatabaseName"
connectionString="Server=localhost;User
ID=xxxx;Password=xxxx;Database=xxxx;Persist Security Info=True;async=true"
providerName="System.Data.SqlClient" />
</OurApplicationName>
</OurCompanyName>
......
<appSettings/>
<connectionStrings/>
<system.web/>
</configuration>
-------------------------------------

I just can't get the code right for extracting this information....

Many thanks in advance

Griff
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top