Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 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