Andrej Tozon's blog

In the Attic

NAVIGATION - SEARCH

TableAdapters & connection strings in VS2005

When you create a new TableAdapter for your DataSet using Configuration Wizard, VS kindly generates new code file for you and adds the specified connection string to application settings. The problem is that connection string also gets included in the auto generated code file and consequently embedded into compiled assembly, which may result in "unexpected behavior" in production environment, like application trying to connect to the wrong server and stuff... Not to mention potential security risks...
To turn this behavior off and store your connection string to configuration file only, select (Connection string) setting in your project's Settings page and switch its GenerateDefaultValueInCode property to false.