2
I need to add some columns to a database as follows:
save a comic line to a variable
Market novo = new market(); novo = context.Markets.where(blabla).First();
change a row column
novo.ParentID = 50;
I save the line in BD, but it is an error because the key of the line I am adding already exists and I do not know how to reset this key in my code.
context.AddObject(novo); // da erro por causa da PrimaryKey
you just have to change the record, and not add a new one, the error there is only in your logic... and, I think it’s not ADO.NET
– Rovann Linhalis
There’s no mistake, that’s the point. This table is a tree with hierarchies, what ueu want to do is search a sub-category(line), just change Parentid and add it in the comic again, but now it will belong to another parent category
– ihavenokia