update with textboxes

  • Thread starter Thread starter Jose_Csharp
  • Start date Start date
J

Jose_Csharp

Hello group,
I trying to do an aplicattion where it shows the data from a sql server
database and you can save the changes. When I use a datagrid I haven´t any
problem to update de changes but when I use textboxes to show and make the
changes of any field of the table the command UPDATE doesn´t run correctly
(with no errors but doesn´t update de table).
I use the wizard to generate the sqlConnection, sqlDataAdapter ang the
DataSet. I use the DataBindings of the textboxes to link with the dataSet.

I'm using to update:
private void buttonUpdate_Click(object sender, System.EventArgs e)

{

SqlCommandBuilder cm = new SqlCommandBuilder(sqlDataAdapter1);

sqlDataAdapter1.Update(dataSetUsuario1);

}

I don´t know where is the error, I try with the calling the method
GetChanges and AcceptChanges of the dataSet but nothing. Thanks in
advance!!!
 
I will answer my own question. Well I can update the database using the
textbox with databings adding the next line before to call the update method
to end the editing on the current record, saving changes to the underlying
dataset:

BindingContext[myDataSet, "myTable"].EndCurrentEdit();
 
Back
Top