Really basic question about databinding

  • Thread starter Thread starter JohnFol
  • Start date Start date
J

JohnFol

I have followed one of the walkthroughs that shows a parameterised query
populating some text boxes that are data bound to a data set. The full
details are found at

http://msdn.microsoft.com/library/d...gdatainwindowsformusingparameterizedquery.asp


All this works, however I now want any changes made to the text boxes to be
written back to the db. I know I need the following to write the changes
back to the db:
OleDbDataAdapter1.Update(DsAuthors1, "authors")

However the way to get the values of the text boxes into the dataset seems
cumberson. I have done the following, but surely there must be an easier way
as an association between the dataset/table/field has already been
established.

Dim iPos As Integer

iPos = Me.BindingContext(DsAuthors1, "authors").Position

DsAuthors1.Tables("authors").Rows(iPos)("au_LName") = Me.txtAuthorLName.Text



Any Ideas?
 
John,

This is one of the most asked questions in these newsgroups, a line is
pushed down in the datatable by a rowchange. You can force that with an
endcurrentedit of the datasource.

Probably it will be this, before your update

BindingContext(DsAuthors1.Tables, "authors").EndCurrentEdit()

I hope this helps,

Cor
 
Back
Top