Compiler Error Message: CS0103: The name 'context' does not exist in the current context
Source Error:
Line 24: public AppEnv(HttpContext Context)
Line 25: {
Line 26: context = Context;
Line 27: } //--------------------------------------------------------------- End public AppEnv().
Line 28:
using System;
using System.Collections.Specialized;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// Summary description for AppEnv
/// </summary>
///
namespace Genealogy
{
public class AppEnv
{
public AppEnv(HttpContext Context)
{
context = Context;
} //--------------------------------------------------------------- End public AppEnv().
public string GetAppSetting(string setting)
{
string val;
try
{
val = (string)((NameValueCollection)context.GetConfig("appSettings"))[setting];
} // End try.
catch (NullReferenceException)
{
val = "";
} // End catch.
if (val == null)
{
val = "";
} // End if.
return val;
} //------------------------------------------------- End public string GetAppSetting().
public SqlConnection GetConnection()
{
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = "server" + GetAppSetting("datasource") +
";database=" + GetAppSetting("database") +
";uid=" + GetAppSetting("userid") +
";pwd=" + GetAppSetting("password") +
((GetAppSetting("timeout").Length > 0) ? ";Connection Timeout=" + GetAppSetting("timeout")
: "");
return myConnection;
} //------------------------------------------ End public SqlConnection GetConnection().
} //------------------------------------------------------------- End public class AppEnv{}.
} //----------------------------------------------------------------- End namespace Genealogy{}.
Any idea's?
This post has been edited by sawman: 17 January 2009 - 01:44 PM

New Topic/Question
Reply




MultiQuote





|