Changed Database Name — Datatable Adapters broke

We've recently changed the name of the SQL DataBase our WebApp is using. Now, each of the DataTableAdapters will update to the new ConnectionString.

Our setup is as follows:

1) Interface (WebSite Project)

2) Business Logic (Class Library Project)

3) Data Access (Class Library Project) ---> Contains many DataSet classes

The app.config of the Data Access project contains the only connection string. When creating each of the DataTableAdapters, the wizard points to it correctly. Now, we've had to change the ConnectionString, and all of the existing DataTableAdapters (about ~60) will not work.

Simply changing the ConnectionString has not worked. What am I missing?



Make sure the connection string name in your config is the same as the one in the Settings File. Because in the generated code, when it initialzed the connectionstring it setting the connection string as follow :

private void InitConnection() {
            this._connection = new global::System.Data.SqlClient.SqlConnection();
            this._connection.ConnectionString = global::ConsoleApplication4.Properties.Settings.Default.MyConnectionString;

Make sure that in your app config the name of your connectionString is the same. for example

        <add name="ConsoleApplication4.Properties.Settings.MyConnectionString"
            connectionString="Data Source=MyServer;Initial Catalog=MyDB;Integrated Security=True"
            providerName="System.Data.SqlClient" />

The problem was in the Settings.Designer.cs file. Its an auto-generated file that did not update after the normal updating/clean/build process.

Thanks Everyone :-)

Need Your Help

are cookies secure from hijacking over http

http cookies https

I see facebook sends cookies over http. How are they secure from hijacking? If I were to copy the cookie onto another computer would I be logged in?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.