cant get SqlCeResultSet to update with bound control. ?

J

Jim

hi



I have a SqlCeResultset (sql mobile) that is updateable. i want to have
simple databinding for several text boxes. i use a method by Paul Yao where
i bind a combobox control to the resultset. i then bind a text box to the
combobox as shown below in Pauls example.



// cboxTasks.DataSource = rsResultSet;
// cboxTasks.DisplayMember = "Name";
// cboxTasks.ValueMember = "Ident";



// txtbox1.DataBindings.Add("Text", cboxTasks.DataSource, "Name");





This works but any changes to the textbox text do not stick. :( If i move
off the record and back the old data is still there. If i look at the result
set it does appear as updateable.



Any ideas why this will not work with a SqlCeResultset?
 
J

Jim

more info

i have a grid above the text box and comdobox

the query for the bound combobox and text box are based on the pk of the
selected grid row

so when the user selects another grid row i run another query for the bound
combobox and text box

to get this to work i call the DataBindings.Clear() method for the combo and
text box controls

so in this application bindings are dynamic and are reset each time the user
clicks on a grid row


could it be that my bound controls are not commiting their changes before i
clear the bindings on the next grid row click?

can i force the bound controls to commit changes to the resultset?
 
J

Jim

I changed all the code to use the new ResultSetView for binding. So there is
no combobox just the resultset the resultsetview and the text box.

the code below still exibits the same problem of not updating the database
if i edit the textbox and change the grid row. the resultset for the details
control is updateable. the code below works but does not let updates stick

private void dgOrders_CurrentCellChanged(object sender, EventArgs e) //
<-- grid row change
{
this._rsOrderDetail =
_order.LoadOrderDetailByPK(Current.CurrentOrderPK);
this._viewOrderDetail = _rsOrderDetail.ResultSetView;
this.txtName.DataBindings.Clear(); // <-- Could this
cause the changes to fall off as new rows are selected?
this.txtName.Text = string.Empty;
this.txtName.DataBindings.Add("Text", _viewOrderDetail, "NAME");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top