Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 47:         SqlCommand cmd_lang = new SqlCommand("SELECT Menu_ID from Menu WHERE Menu_Text='" + language + "' AND Menu_Active='1'", new SqlConnection(myConnectionString));
Line 48:         cmd_lang.Connection.Open();
Line 49:         string langID = cmd_lang.ExecuteScalar().ToString();
Line 50:         cmd_lang.Connection.Close();
Line 51: 

Source File: d:\web\cajus.dk\UserControls\Frontend\ProductBasket.ascx.cs    Line: 49

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   UserControls_Frontend_ContentModules_View_ProductBasket.Page_Load(Object sender, EventArgs e) in d:\web\cajus.dk\UserControls\Frontend\ProductBasket.ascx.cs:49
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +79
   System.Web.UI.Control.LoadRecursive() +130
   System.Web.UI.Control.LoadRecursive() +200
   System.Web.UI.Control.LoadRecursive() +200
   System.Web.UI.Control.LoadRecursive() +200
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2853


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9214.0