I am a newbie here so be nice :) i am getting the following error when trying to run my site. My site is being ran off a web host. SQL 2005 is the database structure i am using.
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 202:
Line 203:public static int GetRandomAlbumID() {
Line 204:using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Personal"].ConnectionString)) {
Line 205:using (SqlCommand command = new SqlCommand("GetNonEmptyAlbums", connection)) {
Line 206:command.CommandType = CommandType.StoredProcedure;
alafferty
Member
15 Points
3 Posts
Object reference not set to an instance of an object Error
Jul 10, 2006 02:36 AM|LINK
I am a newbie here so be nice :) i am getting the following error when trying to run my site. My site is being ran off a web host. SQL 2005 is the database structure i am using.
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 202:
Line 203: public static int GetRandomAlbumID() {
Line 204: using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Personal"].ConnectionString)) {
Line 205: using (SqlCommand command = new SqlCommand("GetNonEmptyAlbums", connection)) {
Line 206: command.CommandType = CommandType.StoredProcedure;
Source File: c:\domains\aaronlafferty.com\wwwroot\test\App_Code\PhotoManager.cs Line: 204
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
PhotoManager.GetRandomAlbumID() in c:\domains\aaronlafferty.com\wwwroot\test\App_Code\PhotoManager.cs:204
PhotoManager.GetPhotos() in c:\domains\aaronlafferty.com\wwwroot\test\App_Code\PhotoManager.cs:100
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2040
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.FormView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.FormView.EnsureDataBound() +163
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Any help would be greatly appriciated.
Thanks