c# - Changed Database Name -- Datatable Adapters broke -
we've changed name of sql database our webapp using. now, each of datatableadapters update new connectionstring.
our setup 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 data access project contains connection string. when creating each of datatableadapters, wizard points correctly. now, we've had change connectionstring, , of existing datatableadapters (about ~60) not work.
simply changing connectionstring has not worked. missing?
thanks
make sure connection string name in config same 1 in settings file. because in generated code, when initialzed connectionstring setting connection string follow :
private void initconnection() { this._connection = new global::system.data.sqlclient.sqlconnection(); this._connection.connectionstring = global::consoleapplication4.properties.settings.default.myconnectionstring; }
make sure in app config name of connectionstring same. example
<connectionstrings> <add name="consoleapplication4.properties.settings.myconnectionstring" connectionstring="data source=myserver;initial catalog=mydb;integrated security=true" providername="system.data.sqlclient" /> </connectionstrings>
Comments
Post a Comment