使用WebMatrix - Definition Editor时删除了IsGftCard。我把IsGiftCard放回编辑器,给它一点 - 数据类型,并尝试将数据值更改为false,因为它不适用于Null字符但是当我尝试保存文件时web矩阵出错
无法将值NULL插入“IsGiftCard”列,表'incrediblebranding.dbo.ProductVariant';列不允许空值。更新失败。 声明已经终止。
所以我允许Null字符允许保存文件,但是当我尝试在我的PC上访问该站点(localhost)时,我在Internet Explorer中收到以下错误。
System.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'IsGiftCard', table 'incrediblebranding.dbo.ProductVariant'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
at Microsoft.WebMatrix.DatabaseManager.SqlDatabase.SqlDatabaseProvider.EditTable(String connectionString, String schema, TableInfo tableInfo)
at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.EditTable(DatabaseConnection databaseConnection, String schema, Object tableInfoData, String configPathState)
at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.EditTable(String schema, Object tableInfoData)
at Microsoft.WebMatrix.DatabaseManager.Client.ClientTable.CommitChanges()
at Microsoft.WebMatrix.DatabaseManager.Client.TableDesignerViewModel.PerformSave(). error
Server Error in '/' Application.
--------------------------------------------------------------------------------
'ProductVariant'上的'IsGiftCard'属性无法设置为'null'值。您必须将此属性设置为“Boolean”类型的非null值。 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Data.ConstraintException:'ProductVariant'上的'IsGiftCard'属性无法设置为'null'值。您必须将此属性设置为“Boolean”类型的非null值。
Source Error:
Line 76: <div class="clear">
Line 77: </div>
Line 78: @Html.Action("RecentlyViewedProductsBlock", "Catalog")
Line 79: <div class="clear">
Line 80: </div>
Source File: c:\Users\USER\Documents\My Web Sites\nopCommerce\Views\Shared\_ColumnsThree.cshtml Line: 78
Stack Trace:
[ConstraintException: The 'IsGiftCard' property on 'ProductVariant' could not be set to a 'null' value. You must set this property to a non-null value of type 'Boolean'. ]
System.Data.Common.Internal.Materialization.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal) +105
lambda_method(Closure , Shaper ) +1240
System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly(Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) +218
lambda_method(Closure , Shaper ) +215
System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) +170
System.Data.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +84
此错误还有很多,但我简短了。无论如何都要编辑product_variant文件以将默认值更改为False并保存.dbo。文件。或者是否有一种方法可以完全替换product_variant文件。马克
,如果你能提供帮助,我对此非常陌生