views:

301

answers:

0

I'm sure I'm missing something very simple but I can't seem to discover what it is.

I have a Silverlight 2.0 project and associated web site where I have added an ADO.NET Entity Data model and ADO.NET Data Service. The model contains three tables, one of which is called Volunteer. I use ctx.BeginExecute to get the data from this table to populate a list box with names. This works fine. I capture the SelectionChanged event to grab the selected name and copy it to a text box. This is so I can make changes to the text. I then have a button which will be used to persist changes when clicked.

In the Click event handler I have the following:

Volunteer v = ctlList.SelectedItem as Volunteer

if (v != null)

{ v.Name = ctlTextBox.Text;

ctx.UpdateObject(v);

ctx.BeginSaveChanges(UpdateCallback, v); }

private void UpdateCallback(IAsyncResult result) { ctx.EndSaveChanges(result);

... here I reload the list using BeginExecute as above }

There's a bit more as I wrap the EndSaveChanges in a try...catch block, but no exceptions are thrown.

When I reload the list, the changed name seems to be there, but when I look at the data in the database directly, the name is unchanged.

So why is my change not being persisted to the database?

Thanks,

related questions