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 24:     Protected Sub page_load(ByVal sender As Object, ByVal e As System.EventArgs)
Line 25:         OpenConn()
Line 26:         Dim mySQL = "SELECT COUNT(BasketItemID) AS iCount FROM vtg_tblBasketList GROUP BY CompID HAVING (CompID = " & Request.Cookies("iCompID").Value & ")"
Line 27:         Dim myCommand As New SqlCommand(mySQL, myConnection)
Line 28:         Dim iCount = myCommand.ExecuteScalar()

Source File: \\NAS40ENT\domains\v\vet2go.co.uk\user\htdocs\Basket.aspx    Line: 26

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.basket_aspx.page_load(Object sender, EventArgs e) in \\NAS40ENT\domains\v\vet2go.co.uk\user\htdocs\Basket.aspx:26
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433