need to replace data source string with the web config defined one.

Posted on 2008-11-13
Medium Priority
Last Modified: 2012-06-22
I have the following

 srcUser.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TestDB.mdf;Integrated Security=True;User Instance=True"
<add name="ConnectionString" connectionString="

need to use the web config.
Question by:mathieu_cupryk

Accepted Solution

amx earned 2000 total points
ID: 22951501
Put this in your web.config

            <add name="test" connectionString="srcUser.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TestDB.mdf;Integrated Security=True;User Instance=True""/>

and put this in the code
string connStr  = ConfigurationManager.ConnectionStrings["test"].ConnectionString;

Open in new window


Expert Comment

by:Refael Ackermann
ID: 22951518
This should work:

srcUser.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"];

Open in new window


Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

624 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