Invalid Column Name - ShoppingCartItem. OrderSummary

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi all,

I running into the following error. I have added the following feild in Product.dbo


/// <summary>
/// Gets or sets CCCPack
/// </summary>
public virtual int? CCCPack { get; set; }


I have successfully been able to display this in Product.Template. But I would like it to display on the order summery page.

I have added the following in
Domain - Orders - ShoppingCartItems.cs


/// <summary>
/// Gets or sets the Pack
/// </summary>
public virtual int? CCCPack { get; set; }


In

Nop.Web - Prsentation - ShoppingCart - ShoppingCartModel.cs Nested Class - ShoppingCartItemModel

public int? CCCPack { get; set; }


In
Nop.Web - Presentation - ShoppingCartController.cs Region Cart Items 

CCCPack = sci.ProductVariant.Product.CCCPack,


In
Nop.Web - Presentation - Shopping Cart - OrderSummery

I have added

<td style="white-space: nowrap;">
@item.CCCPack
</td>


Im running the following exeception error.
Invalid column name 'CCCPack'. 
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: Invalid column name 'CCCPack'.

Source Error:


Line 78:         <div class="clear">
Line 79:         </div>
Line 80:         @Html.Action("MiniShoppingCart", "ShoppingCart")
Line 81:         <div class="clear">
Line 82:         </div>



I have updated the the Mini ShoppingCart Model and ActionResult MiniShoppingCart Controller by adding the following feilds.

public int? CCCPack { get; set; }

CCCPack = sci.ProductVariant.Product.CCCPack,



I don't need the MiniShoppingCart partial view to display CCPack but only the OrderSummary Page.

It is still throwing the following exeception error that the column is invalid even though it is in the Product.dbo table.

If anyone could advise or help me on this I would be highly apprecaite as all I need is to view the CCCPack on the ordersummeray page.

Kind Regards

Richard.
11 years ago
Done removed the following


Domain - Orders - ShoppingCartItems.cs
/// <summary>
/// Gets or sets the Pack
/// </summary>
public virtual int? CCCPack { get; set; }
11 years ago
wertyuio1 wrote:

Invalid column name 'CCCPack'.


That error usually means that you have defined in your domain object the field, but you haven't updated the db table to contain it. So EF tries and query with that field, and the db raises the error.
11 years ago
Yes Thank you Ill will take that on for future notice.

I did define it in the Domain Object but I didn't update the table I didn't need to update this table.

As the feild with all data is allready populated in Product.dbo so I just wanted to display the necessary information. That seem's to be working so far...

My error was in the Controller method

I was trying to call this information using

CCCPack = sci.ProductVariant.ProductCCCPack,


Where I know now I should be using the following.

CCCPack = sci.ProductVariant.Product.CCCPack,


Thank you

Richard
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.