Click to See Complete Forum and Search --> : Simple question


mtroads
February 14th, 2003, 02:18 PM
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?

mtroads
February 14th, 2003, 03:17 PM
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.

DaddyGweedo
February 14th, 2003, 03:32 PM
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.

mtroads
February 14th, 2003, 03:51 PM
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).