Nop 2.10 Product_Picture_Mapping Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
This use to work in 1.9 when writing to Nop_ProductPicture.

INSERT
    INTO [Nop_ProductPicture]
  (
    ProductID,
    PictureID,
    DisplayOrder
  )
  VALUES
  (
    ?m.nprodid,
    ?m.npictureid,
    ?m.nnumberone
  )
Since Nop 1.8 I have been writing the picture,product,productvariant data straight to the DB.  In 2.10 that has somehow changed. When I try to create a Product_Picture_Mapping entry I get the following error:

The Insert Statement conflicted with the FOREIGN KEY restraint "'ProductPicture_Product.' The conflict occured in table 'NopDemo', table dbo.product, column 'ID.'

here is my statement:

INSERT INTO Product_Picture_Mapping

  (
    ProductID,
    Pictureid,
    DisplayOrder
  )
  VALUES
  (
    ?m.nprodid,
    ?m.nPictureID,
    ?m.nnumberone

  )

So the code use to work and now it does not. Any Suggestions?
Please tell me what I am doing wrong.

Thanks!



0
12 years ago
The FOREIGN KEY constraint requires that your ProductId must match an existing Id in the Product table
12 years ago
Yes, I know that and it does match a productid id in the product table. That is what is puzzling me. Like I said I am not a newbie at this and have had no problem with this code until they changed all the table names and fields in 2.0.
12 years ago
I feel like such a dummy. I mispelled one of my variables. It is A ok now.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.