Why doesn't my dataset.AcceptChanges update some new rows i've added? C#
Posted
by user280139
on Stack Overflow
See other posts from Stack Overflow
or by user280139
Published on 2010-06-17T10:50:49Z
Indexed on
2010/06/17
10:53 UTC
Read the original article
Hit count: 168
I have a dataset in a datagrid with some data in it. Recently I've been asked to add some data to that dataset along with some controls to save the data from. I've added a few textboxes, 1 combobox and 3 textboxes that function as viewing of some datetimepickers that I have to use for dates.
I've chosen to use textboxes in combination with datetimepicker because I also need to get and set the value NULL to the database. The problem is that when i call dataset.AcceptChanges() on that dataset that is binded using databinding to those controls it doesn't update the data that's contained in those three textboxes and the combobox. All the new stuff i've added works just fine.
txtDataAcordare.DataBindings.Clear();
txtDataAcordare.DataBindings.Add("Text",dtPersonal,"d_DataAcordare");
txtDataInceput.DataBindings.Clear();
txtDataInceput.DataBindings.Add("Text", dtPersonal, "d_DataInceput");
txtDataSfarsit.DataBindings.Clear();
txtDataSfarsit.DataBindings.Add("Text", dtPersonal, "d_DataSfarsit");
this is the code i use to add the databinding.
I am then using the datetime picker event CloseUp() to add the date into the textbox:
txtDataAcordare.Text = dtpDataAcordare.Text;
txtDataAcordare.Visible = true;
txtDataAcordare.BringToFront();
After all my fields are completed i call:
dtPersonal.AcceptChanges();
and these three textboxes don't get saved! Help, please! dtpDataAcordare.SendToBack();
© Stack Overflow or respective owner