Help with WebConfigurationManager ??
-
Hi I have this line of code in my Web Application; string connect = WebConfigurationManager.ConnectionString s["Scrabble"].Connection String; It will not compile as i am getting the following error: "The name 'WebConfigurationManager' does not exist in the current context" If i add Using System.Web.Configuration to the top of the page, it will compile. However it falls over again on the same line with the message: "Object reference not set to an instance of an object" What am i doing wrong here??? Thanks again
Cheers :)
-
Hi I have this line of code in my Web Application; string connect = WebConfigurationManager.ConnectionString s["Scrabble"].Connection String; It will not compile as i am getting the following error: "The name 'WebConfigurationManager' does not exist in the current context" If i add Using System.Web.Configuration to the top of the page, it will compile. However it falls over again on the same line with the message: "Object reference not set to an instance of an object" What am i doing wrong here??? Thanks again
Cheers :)
Aah sorted.... :) Just for the record I added this to my web.config: <connectionStrings> <add name="ScrabbleConnectionString" ; connectionString="Data Source=JETTA\SQLEXPRESS;Initial Catalog=Scrabble;Integrated Security=True" providerName="System.Data.SqlClient " /> </connectionStrings> I also added the name of the "connectionString" to the line in my code that was causing the problem, I.E: string connect = WebConfigurationManager.ConnectionString s["ScrabbleConnectionString&# 034;].Co nectionString; Thanks Cheers :)
-
Hi I have this line of code in my Web Application; string connect = WebConfigurationManager.ConnectionString s["Scrabble"].Connection String; It will not compile as i am getting the following error: "The name 'WebConfigurationManager' does not exist in the current context" If i add Using System.Web.Configuration to the top of the page, it will compile. However it falls over again on the same line with the message: "Object reference not set to an instance of an object" What am i doing wrong here??? Thanks again
Cheers :)
use configurationmanager instead of webconfigurationmanager