I'm trying to update a textbox that is bound to a dataset. However, I can't update this by using the textbox1.text property. How can I update this?
Printable View
I'm trying to update a textbox that is bound to a dataset. However, I can't update this by using the textbox1.text property. How can I update this?
I figured out how to assign it to the data set but I can't get the data set to update that change in the field to the database. Any help would be really appreciated.
You might have to give some more details.
I'm assuming you are filling a database with:
SqlDataAdapter.Fill(myDataSet)
or
OleDbDataAdapter.Fill(myDataSet)
to reflect the changes you need to call
SqlDataAdapter.Update(myDataSet)
or
OleDbDataAdapter.Update(myDataSet)
The update function takes all change/add/deletes from the dataset and makes them in the database.
Hope that helps. If not, you'll need to give some more information and possibly show some code.
DG.
Here's the code that I use to update the Field:
Me.BindingContext(objdsMort, "Mortgage").Current.row.item("Principal") = strNew
'Then to update the database:
Me.BindingContext(objdsMort, "Mortgage").EndCurrentEdit()
objDataSetChanges = CType(objdsMort.GetChanges, AMT.dsMort)
Me.OleDbConnection1.Open()
OleDbDataAdapter1.Update(objDataSetChanges)
Me.OleDbConnection1.Close()
objdsMort.Merge(objDataSetChanges)
objdsMort.AcceptChanges()
I am filling the database with OleDbDataAdapter.Fill(myDataSet).