Solved

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

Posted on 2008-10-24
4
1,041 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
[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
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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

737 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