On 22 Apr., 17:52, Anders <[email protected]> wrote:
> On Apr 22, 12:56 pm, mabu <[email protected]> wrote:
>
> > Some Code may help:
> >[...]
> > In the database i following:
> > * p is inserted twice with correct reportid
> > * c is inserted three times with the first product-id
> > * c2 is inserted once but without a product id
>
> Just noticed: How did p get inserted twice? Don't you have a primary
> (or unique) key on the column? And if you don't, do you have foreign
> keys?
Every entity has its ID Column defined with the primary key statement.
And every association from a child to a parent has
the foreignkey statement- should be ok or?
> I created a simplified test, that uses the northwind schema.
> using (var context = new ReadTest().CreateDB()) {
> var c = new nwind.Category { CategoryName = "cat1" };
> context.Categories.InsertOnSubmit(c);
> var p = new nwind.Product { Category = c, ProductName = "prod1" };
> context.Products.InsertOnSubmit(p);
> context.SubmitChanges();
Did you also create 2 products referencing the same category? What
happens then?
Martin
--
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en.