Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

connection info in the configuration file

Posted on 2009-04-03
2
Medium Priority
?
138 Views
Last Modified: 2012-05-06
hi

where to store the connection info in the configuration file of a project and how to read it ?
0
Comment
Question by:Pure_Heart
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 24058886
Read connection string from web.config
http://snippets.dzone.com/posts/show/1343

Custom Configuration SQL Connection String Section
http://www.codeproject.com/KB/database/CustomConfigSqlConn.aspx
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 24058891
In your app.config
<configuration>
<appSettings>
      <add key="connectionString" value="server=servername;database=dbname;integrated security=sspi" />
 
</appSettings>
</configuration>


To reference that in your code:

Dim oConn As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question