ورود

View Full Version : Concurrency violation: the DeleteCommand affected 0 of the expected 1 records



swallow.pa
یک شنبه 08 مرداد 1391, 20:37 عصر
سلام به همه دوستان
براي پاك كردن از اين كد استفاده مي كنم
bs.Current.Delete()
bs.EndEdit()
TableAdapter.Update(Ds.Item)
ممنون
اما خطاي نشان مي دهد اشكال از كجاست
Concurrency violation: the DeleteCommand affected 0 of the expected 1 records

hamid_kha
دوشنبه 09 مرداد 1391, 19:09 عصر
سلام
چرا از DeleteObject استفاده نمیکند؟
که با Linq راحت تره:لبخندساده:


(from u in DataContext.Context.Users
where u.UserID == UserID
select u).ToList().ForEach(DataContext.Context.DeleteObje ct);