Hi I moved my vs 2008 'still in development' web app to vs 2010.
I get a Null reference error on the below code behind. I hard coded the connection string straight in the C# code behind to test it and works fine. I do have the 'using System.Web.Configuration;' up top.
Two things confuse me:
1. there is no app settings node in the config file, should I just put it in.
2. I try to convert to web application and does not take?
code behind:
private String connectionString =
WebConfigurationManager.ConnectionStrings["GZK"].ConnectionString;
web.config debug :
<connectionStrings>
<add
name="GZK"
connectionString="Data Source=grantorino\enterprise;Initial
Catalog=GZK;Persist Security Info=True;User
ID=GZK;Password=xxxxx"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
I get a Null reference error on the below code behind. I hard coded the connection string straight in the C# code behind to test it and works fine. I do have the 'using System.Web.Configuration;' up top.
Two things confuse me:
1. there is no app settings node in the config file, should I just put it in.
2. I try to convert to web application and does not take?
code behind:
private String connectionString =
WebConfigurationManager.ConnectionStrings["GZK"].ConnectionString;
web.config debug :
<connectionStrings>
<add
name="GZK"
connectionString="Data Source=grantorino\enterprise;Initial
Catalog=GZK;Persist Security Info=True;User
ID=GZK;Password=xxxxx"
providerName="System.Data.SqlClient"
/>
</connectionStrings>