I wrote these lines:
foreach (var catId in CatIds)
{
AdCategory.AdId = LastAd.AdID;
AdCategory.CategoryId = catId;
EngineDB.Ad_Categories.InsertOnSubmit(AdCategory);
EngineDB.SubmitChanges();
}
and CatIds is an Integer Array.
this command inserts first element correctly but next loop causes this exception:
"Cannot add an entity that already exists."
How can I fix it.
please help me as soon as posible!