We help IT Professionals succeed at work.

Unable to find connection 'dbname' for object 'Web.config'.

steverguy asked
Last Modified: 2012-05-06
Last night I went to bed and my project in Visual Studio 2005 worked just fine.  I start VS this morning and I get:

Unable to find connection 'dbConnectionString (Web.config)1' for object 'Web.config'. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded.

What I don't understand is, this worked yesterday, and all day yesterday I didn't touch my web.config file.  Also, the database, which is an SQL Server is up, and I was able to access it using Enterprise Manager.

Any ideas what caused this?  I'm assuming I could create a new dataset and redo my tableadapters, but if this happend once, I'm sure it will happen again.

Any help would be appreciated! (let me know if i need to post additional info)
Watch Question

1. check you DO have the connection string on your config file in the correct place, even if you did not change it.

2. Did you try to restart your machine?

3. is your sql server on the same machine? Do you manage to open the management studio and run a query?


The connection strings are located right below the <configSections> and right about the <system.web> section.  Does that seem correct?  I am new to ASP.NET and this was autogenerated.
    <add name="mydbConnectionString" connectionString="Data Source=myser.COM;Initial Catalog=mydb;Persist Security Info=True;User ID=username;Password=xxxxxx" providerName="System.Data.SqlClient" />

The SQL Server is hosted remotley.  I am going to try restarting my computer to see if that works.

Thanks for your hquick response!


Restarting the computer did not fix the problem.
is there any chance you have duplicate connection strings in your config file?
Python Developer
This one is on us!
(Get your first solution completely free - no credit card required)
This one is on us!
(Get your first solution completely free - no credit card required)


I deleted the dataset and created a new one, which regenerated the connection string.  It is working now.  What an annoying bug!

Thanks for your help!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.