Solved

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

Posted on 2008-10-24
4
1,037 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
ID: 22798255
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
ID: 22798262
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
ID: 22798379
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
ID: 25579720
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to wrap a merged cells of datagridview column in vs2010 (vb.net) 8 33
encoding an href string 2 20
imap read mail 1 27
vb.net class 3 11
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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 Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

18 Experts available now in Live!

Get 1:1 Help Now