Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have the following code which ends with binding data to a textbox. I am stuck trying to find how after altering the text in the textbox, how to save the change back to the dataset/table. Appreciate any guidance. Thanks.

    Dim dr As DataRow = TXMastersDataset1.Tables("TXMasters").Rows(ListBox 2.SelectedIndex)
    Dim sql2 As MySqlCommand = New MySqlCommand("SELECT TXMasters.ID1,TxMasters.Barcode FROM TXMasters WHERE TXMasters.ID1 = " & dr("ID1") & ";", con)

    TXMastersDataset2 = New DataSet()
    TXMastersDataAdaptor2 = New MySqlDataAdapter()
    TXMastersDataAdaptor2.SelectCommand = sql2
    TXMastersDataAdaptor2.Fill(TXMastersDataset2, "TXMasters")


    TextBox3.DataBindings.Add(New Binding("Text", TXMastersDataset2, "TXMasters.Barcode"))

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by ZOR View Post
    I have the following code which ends with binding data to a textbox. I am stuck trying to find how after altering the text in the textbox, how to save the change back to the dataset/table. Appreciate any guidance. Thanks.

    Dim dr As DataRow = TXMastersDataset1.Tables("TXMasters").Rows(ListBox 2.SelectedIndex)
    Dim sql2 As MySqlCommand = New MySqlCommand("SELECT TXMasters.ID1,TxMasters.Barcode FROM TXMasters WHERE TXMasters.ID1 = " & dr("ID1") & ";", con)

    TXMastersDataset2 = New DataSet()
    TXMastersDataAdaptor2 = New MySqlDataAdapter()
    TXMastersDataAdaptor2.SelectCommand = sql2
    TXMastersDataAdaptor2.Fill(TXMastersDataset2, "TXMasters")


    TextBox3.DataBindings.Add(New Binding("Text", TXMastersDataset2, "TXMasters.Barcode"))

    Have you tried this?
    Code:
    TXMastersDataset2.Update
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •