In the settings file use a token for the database name
server=localhost; database=[db]; uid=sa; pwd=
then in your code read the connection string from the config file and do a string replace;
connetionString = connetionString.Replace("[db]", "YourDatabaseNameHere");