Solved

connection info in the configuration file

Posted on 2009-04-03
2
128 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
  • 2
2 Comments
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
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 125 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Starting to learn JAVA, 7 46
Paging GridView 7 32
Code enhancement 5 12
Copy/Clone an object. 9 7
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now