What am I doing wrong?
This works:
SQLConn.ConnectionString = "Data Source=McD_DB;Initial Catalog=McDFeelGood;User ID=uuu;Password=ppp"
Now I want to put it in my web.config, but these don't work ("ConnectionString property has not been initialized"):
SQLConn.ConnectionString = ConfigurationSettings.AppSettings("McDFeelGoodConnectionString")(VS IDE says this method is obsolete)
SQLConn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("McDFeelGoodConnectionString")
<connectionStrings>
<add name="McDFeelGoodConnectionString" connectionString="Data Source=McD_DB;Initial Catalog=McDFeelGood;Persist Security Info=True;User ID=uuu;Password=ppp" providerName="System.Data.SqlClient" />
</connectionStrings>
OK well this worked:
<appSettings>
<add key="McDFeelGoodConnectionString" value="Data Source=McD_DB;Initial Catalog=McDFeelGood;Persist Security Info=True ;ID=uuu;Password=ppp" />
</appSettings>
No comments:
Post a Comment