How to get the connection information from machine.config file ?

i am developing windows applicaiton using visul studio 2005 c#. The project not having app.config file.
Connection string information is avilable in machine.config file. How do i read the connection string from machine.config file ?
Varshini SAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Monica PConnect With a Mentor Software DeveloperCommented:
                <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>

Open in new window

read values

 Configuration machineConfig = ConfigurationManager.OpenMachineConfiguration();
            foreach (ConnectionStringSettings connectionstring in machineConfig.ConnectionStrings.ConnectionStrings)
                // u can have multiple connection strings

Open in new window

Srinivasulu MuppalaConnect With a Mentor Lead DeveloperCommented:
Nice question, i found exact artical for your req.
please  check in url:
All Courses

From novice to tech pro — start learning today.