I have further researched the problem and have found that somehow the relation is inserting a new record even though it has been set.
So take this example of three tables: Order, Orders_Products, Products
The Order table has an auto primary id.
The Orders_Products has an auto incrememt primary id, order_id, and product_id
The Products table just has a auto increment id and a name.
The Orders_Products table has a one to many relationship to both the order, and the products table.
When I do this
Code: Select all
OrdersProduct op = new OrdersProduct();
op.Order = CurrentOrder;
op.Product = SelectedProduct;
db.OrdersProducts.InsertOnSubmit(op);
db.SubmitChanges();
I am not sure why it is doing this. It inserts another version of the Product of which I referenced even though the product class clearly has its auto id set correctly to the correct reference.
I did receive the file you had sent me. I do not get the proble when there is only one relationship point to another table. But soon as I have on table that has two relationships to many. There is an issue.