Really basic question about databinding

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JohnFol

    Really basic question about databinding

    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




    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:
    OleDbDataAdapte r1.Update(DsAut hors1, "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.BindingConte xt(DsAuthors1, "authors").Posi tion

    DsAuthors1.Tabl es("authors").R ows(iPos)("au_L Name") = Me.txtAuthorLNa me.Text



    Any Ideas?




  • Cor Ligthert [MVP]

    #2
    Re: Really basic question about databinding

    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.Tabl es, "authors").EndC urrentEdit()

    I hope this helps,

    Cor


    Comment

    • JohnFol

      #3
      Re: Really basic question about databinding

      It does,

      as ever, many thanks


      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
      news:OlCISbioFH A.3256@TK2MSFTN GP12.phx.gbl...[color=blue]
      > 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.Tabl es, "authors").EndC urrentEdit()
      >
      > I hope this helps,
      >
      > Cor
      >[/color]


      Comment

      Working...