It seems, the problem is in sp.
Here is the right sp,
ALTER PROCEDURE [dbo].[InsertUpdateOrderProduct]
@OrderID INT,
@ProductName VARCHAR(100),
@Quantity INT,
@Price FLOAT
AS
BEGIN
IF EXISTS (SELECT orderid From dbo.OrderProduct where OrderID=@OrderID)
BEGIN
UPDATE
dbo.OrderProduct
SET
OrderID=@OrderID,
ProductName=@ProductName,
Quantity=@Quantity,
Price=@Price
Where
OrderID=@OrderID
END
ELSE
BEGIN
INSERT INTO dbo.OrderProduct
(OrderID,ProductName,Quantity,Price)
SELECT
@OrderID,@ProductName,@Quantity,@Price
END
END
I assume the code behind codes are executed well without error.
Best of luck.
cheers