If the settings.settings file is automatically generated in the class library after you add LINQ to SQL and the database server is connected, the App. Config file is used to store the connection string (figure I)
If you want to modify the connection string, which one or all of them should be modified? After my research found that the simplest only need to modify dbml a file, because the three are related, DBML modified after the other two files will be modified accordingly, but this is in order: DBML, Settings.settings and App. Config, modifying one of the connection strings will synchronize the connection strings in the file afterwards. Otherwise, the reverse modification will be troublesome, such as modifying the connection string in app. Config (the name of the connectionstrings node is named according to the project name. Properties.settings. Connection string name rule naming) must open the Settings.settings file before Can prompt the update, after the update setting.settings must open dbml and re-select the current connection to prompt for updates dbml
However, sometimes it is not possible to directly modify the dbml, such as the development machine can not connect to the database server and modify the connection in dbml to connect to the database server (Figure IV) can only modify settings.settings and move the DBML connection drop-down option.
Modify the connection string in LINQ to SQL