Error in AddEditArticle.aspx
When I try to add an article to the AddEditArticle.aspx page I get ViewCount cannot be null exception.
Cannot insert the value NULL into column 'ViewCount', table 'C:\WEBSITES\VIBESCARDOMAIN\APP_DATA\ASPNETDB.MDF. dbo.tbh_Articles'; column does not allow nulls. INSERT fails.
The statement has been terminated.
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.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'ViewCount', table 'C:\WEBSITES\VIBESCARDOMAIN\APP_DATA\ASPNETDB.MDF. dbo.tbh_Articles'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Source Error:
Line 111: }
Line 112: else
Line 113: return cmd.ExecuteNonQuery();
Line 114: }
Line 115:
Source File: c:\Websites\VibesCarDomain\App_Code\DAL\DataAccess .cs Line: 113
Stack Trace:
[SqlException (0x80131904): Cannot insert the value NULL into column 'ViewCount', table 'C:\WEBSITES\VIBESCARDOMAIN\APP_DATA\ASPNETDB.MDF. dbo.tbh_Articles'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection) +95
System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) +82
System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) +346
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
System.Data.SqlClient.SqlCommand.FinishExecuteRead er(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186
System.Data.SqlClient.SqlCommand.RunExecuteReaderT ds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
System.Data.SqlClient.SqlCommand.RunExecuteReader( CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149
MB.VibesDomain.DAL.DataAccess.ExecuteNonQuery(DbCo mmand cmd) in c:\Websites\VibesCarDomain\App_Code\DAL\DataAccess .cs:113
MB.VibesDomain.DAL.SqlClient.SqlArticlesProvider.I nsertArticle(ArticleDetails article) in c:\Websites\VibesCarDomain\App_Code\DAL\SqlClient\ SqlArticlesProvider.cs:313
MB.VibesDomain.BLL.Articles.Article.InsertArticle( Int32 categoryID, String title, String Abstract, String body, String country, String state, String city, DateTime releaseDate, DateTime expireDate, Boolean approved, Boolean listed, Boolean commentsEnabled, Boolean onlyForMembers) in c:\Websites\VibesCarDomain\App_Code\BLL\Articles\A rticle.cs:561
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Objec t 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) +358
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +17
System.Web.UI.WebControls.ObjectDataSourceView.Inv okeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +676
System.Web.UI.WebControls.ObjectDataSourceView.Inv okeMethod(ObjectDataSourceMethod method) +60
System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteInsert(IDictionary values) +827
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +173
System.Web.UI.WebControls.DetailsView.HandleInsert (String commandArg, Boolean causesValidation) +625
System.Web.UI.WebControls.DetailsView.HandleEvent( EventArgs e, Boolean causesValidation, String validationGroup) +745
System.Web.UI.WebControls.DetailsView.OnBubbleEven t(Object source, EventArgs e) +163
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.DetailsViewRow.OnBubbleE vent(Object source, EventArgs e) +118
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +106
System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String eventArgument) +175
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +244
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3835
|