2

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 ファイルを完全に置き換える方法はありますか。私はこれに非常に慣れていません。助けていただければ、マーク

4

0 に答える 0