I hav a program with 2 textboxes in which I hav to display data fields from sql tables and insert values in to table through these 2 textboxes.
the program goes like this
Dim ds As New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
da.Fill(ds, "ramtable")
Dim rno As Byte
rno = 0
call filldata(rno)
End Sub
Private Sub filldata(ByVal r1 As Byte)
t1.Text = ds.Tables("ramtable").Rows(r1).Item(0) textbox1 filled for the first time with value in sql table (suppose "abc"
t2.Text = ds.Tables("ramtable").Rows(r1).Item(1)
End Sub
Private Sub upd_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upd_btn.Click
Dim r As DataRow
r = ds.Tables("ramtable").NewRow
r.Item(0) = Val(t1.Text) here the new value is inserted into textbox1 which will be taken into sql but this value remains "abc"(previously filled one) so I m getting error while updating as value already exist
r.Item(1) = t2.Text
ds.Tables("ramtable").Rows.Add(r)
da.Update(ds, "ramtable")
t1.Text = ""
t2.Text = ""
End Sub
so why the value of textbox1 is not changing even if I have changed it in the web form