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