Truly this is as easy as pie
in web.config file add a node like this in the <appsettings> node
<add key=”dbConnection” value=”
Server=YOUR_SERVER_NAME;User ID=USER_NAME_DB;Password=YOUR_PASSWORD;Initial Catalog=DBNAME;”/>
Now in the code file add the following line whereever u want to get the connection String
string conStr = ConfigurationManager.AppSettings[“dbConnection”];
and then do whatever you wanna do with that!