OK
I have made a little progress on this....

Seems I was missing:
dataset.Tables[0].AcceptChanges();

However, this alone did not fix it.... I needed to manually assign the value
from the 'bound' textbox, by doing...

dataset.Tables[0].Rows[0]["Name"]=boundtextbox.Text.ToString();

This seems odd to me... as the textbox appears bound to the datatable, but
when I change the value, it doesn't seem to be writing back properly....
although a MessageBox.Show(dataset.Tables[0].Rows[0]["Name"].ToString());
shows the correct value... it doesn't have the same (required) effect until
I specifically assign the value in code.

Can anyone help??

Thanks


"Paul Aspinall" <paul@aspy.co.uk> wrote in message news:...
> Hi
> I have a dataset which consists of a datatable.
>
> I make changes to the data in the datatable, via the use of a bound
> textbox. When debugging, I output the value of:
>
> dataset.Tables[0].Rows[0]["Name"].ToString()
>
> and this reflects the correct value that I want. However, the dataadapter
> does not seem to recognise the change, and doesn't update the underlying
> table back to the DB.
>
>
>
> However, if I specifically set the value of the DB, via
>
> dataset.Tables[0].Rows[0]["Name"]="aaaaa";
>
> then all seems to work fine.....
>
>
>
> Any ideas??
>
>
>
> Thanks
>
>
>
>

Re: DataAdapter problems... by Cor

Cor
Wed Jan 26 06:09:25 CST 2005

Paul,

One thing you should surely not use before an update is the acceptchanges.
What that does is setting all the datarow rowstates to not changed.

The name of the method is confusing for everybody in the beginning.

To see if you have changes you can do before the update

If (dataset.HasChanges)
and than debug

However the other problem beside that everybody wants to use acceptchanges
is that in a bounded scenario the data is not pushed down to the datasource
when there is not a rowchange.

That you can force by the endcurrentedit
BindingContext(ds.Tables[0]).EndCurrentEdit();

I hope this helps?

Cor