Solved

Connection string error: Requested value 'ConnectionStrings' was not found

Posted on 2008-10-24
4
1,032 Views
Last Modified: 2013-11-07
I'm using ASP.NET 2.0 with VB and I added a table adapter to my dataset that has a bunch of other adapters.  no problem here.  The adapter needed a new conn string so I added one - with a period in the string name ("DataWarehouse.ETL").  Once I did that my website won't build and I get the following error:

"Failed to load dataset because of the following error: Requested value 'ConnectionStrings' was not found."

Everything I've read about the error says that removing the "." from the string and building the site will work, but my project is still hosed.  I've restarted VS, restarted the dev box and it's still not working - help?

0
Comment
Question by:gobofo
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
jinn_hnnl earned 500 total points
Comment Utility
Can you paste your code where you change your connection string? Do you get it from web config file, or set it within your code behind?

JINN
0
 

Author Comment

by:gobofo
Comment Utility
figured it out - I missed one reference to the incorrect conn string (the one with the ".").  I just had to make sure all references were updated in both the webconfig AND the dataset code.
0
 
LVL 10

Expert Comment

by:jinn_hnnl
Comment Utility
That's true,

Well as I feel guilty for getting this mark, I just wanna mention something that you might already know.

When we dealing with stuff like connection string which connected to database and we can have different developing database server, testing server. It's best to separate them and not hard coded them in your code behind

In another word, store conn in webconfig and refer to the application setting key using Configuration class:
Instead of
conn.ConnectionString = "data source=.\SQLEXPRESS;Integrated Security=SSPI;....";

refer to the webconfig
conn.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["myDB"]

in web config
<connectionStrings>
        <add name="myDB"
            connectionString="Data Source=.\SQLEXPRESS; .... />
    </connectionStrings>

when the database path changed, you only have to change in web.config and dont have to recompile the code

>.<

well,

Thanks for the credit though

JINN
0
 

Expert Comment

by:bobbellows
Comment Utility
I figuered it out myself. When using the Table Adapter Tool you are asked at one point to create a connection string. When you go to name the connection string if you have a a "." in the name, such as before the mdf extension of the database, like I did, it will throw the error every time. Solution: Be careful to name your connection string without any "." when the tool asks for a name. It appears to be working now.
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

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

11 Experts available now in Live!

Get 1:1 Help Now