2

我在使用 WebMatrix - 定义编辑器时删除了 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”值。您必须将此属性设置为“布尔”类型的非空值。说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.Data.ConstraintException:“ProductVariant”上的“IsGiftCard”属性无法设置为“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 文件。我对此非常陌生,如果你能帮忙,马克

4

0 回答 0