Giovanni Medico

Giovanni Medico

  • NA
  • 39
  • 591

Update table with textbox.DataBindings

Jun 8 2018 12:41 PM
Hello. I'm trying to figure out how to view the data and update it.
 
The problem is that it does not update
 
ds = new DataSet("Tab_Clienti");
da1 = new SqlDataAdapter("SELECT * FROM Tab_Clienti", Utility.ConnSQL);
//da1.TableMappings.Add("Table", "Tab_Clienti");
da1.Fill(ds, "Tab_Clienti");
txtRagione.DataBindings.Add(new Binding("Text", ds, "Tab_Clienti.Ragione", false, DataSourceUpdateMode.OnPropertyChanged ));
up to here everything is ok, I see the data
 
edit textbox and click button
 
da1.UpdateCommand = new SqlCommandBuilder(da1).GetUpdateCommand();
da1.Update(ds,"Tab_Clienti");
 
update does not work

Answers (4)