Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Textbox.databinding.add - Does not write back to Underlying table

Last post 03-21-2008 8:05 AM by TempleGate. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 03-21-2008 8:05 AM

    • TempleGate
    • Not Ranked
    • Joined on 07-27-2007
    • United Arab Emirates
    • New Member
    • Points 40

    Textbox.databinding.add - Does not write back to Underlying table

    Hi,

    I have a form with a few text boxes. All of them are bound to a table in a SQL database as follows in the Form Load event.


    textbox1.databindings.add(new binding("Text", ds.tables(0), "id")
    textbox2.databindings.add(new binding("Text", ds.tables(0), "Name")

    When the form is loaded, I create a new record into the table with the following code.

    dim dr as datarow
    dr = ds.tables(0).newrow

    dr("id") = 1
    dr("Name") = "Hello"
    ds.tables(0).rows.add(dr)

    The information that I have passed into the datarow (dr) comes visible into the text boxes when the form is displayed....but...if I go and change the word "Hello" to "Hello123" (just for testing purpose)...and press the save button (which runs the update code as below)...I expect the revised "Hello123" to be written back to the table in SQL. But this does not happen...where as the word "Hello" gets written back.

    private sub Save()

    dim dtnew as datatable
    dtnew = ds.tables(0).getchanges(datarowstate.added)

    da.update(dtnew)

    end sub

    Can anyone tell me what I am doing wrong or am I missing something somewhere. Need your assistance desperately.

    Best Rgds
    TempleGate

    • Post Points: 5
Page 1 of 1 (1 items)