I'm having trouble persisting a deleted entity (that is removing it from the database).
I'm pretty new to LLBLGenPro and also to vs2005 (having recently upgraded from 2003). I've been browsing through the forums and I'm sure the answer is right under my nose--but I can't seem to find it.
I have bound a DataGrid to a collection of related items (first setting AllowRemove true):
student.Requests.AllowRemove = true;
requestsCollectionBindingSource.DataSource = student.Requests;
Next I added code to handle my deletion. I've played with several things here and have tried to get a fresh new entity:
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
{
RequestsEntity item = (RequestsEntity)(requestsCollectionBindingSource.Current);
if (item != null)
{
RequestsEntity entity = new RequestsEntity(item.RequestId);
item.Delete();
}
}
after having first tried just deleting from my bindingsource item
RequestsEntity item = (RequestsEntity)(requestsCollectionBindingSource.Current);
if (item != null)
{
item.Delete();
}
The item is removed from my DataGrid, but not from the database and returns next time I visit.
Can anyone help? Thanks in advance! By the way, I'm using 2-class self-servicing code.
Thanks!