From: Tony WONG on
The form call a selected record by "sqlDataReader"
then fill in textboxes by (TxtPhone.Text = reader("Dest_Addr").ToString)

i made the amendments to the textboxes and click Update button

strUpdate = "Update table set col1=(a)TxtPhone where ID='" & ID & "'"
cmdUpdate = New SqlCommand(strUpdate, myConnection)
MsgBox(TxtPhone.Text)
cmdUpdate.Parameters.AddWithValue("@TxtPhone", "852" +
TxtPhone.Text)

however the textbox return to old values

the record can be updated by erasing TxtPhone.Text
cmdUpdate.Parameters.AddWithValue("@TxtPhone", "852111111")

then the problem should be the textbox(TxtPhone.Text)

i try to change to SqlDataAdapter, dataset but still fail.

any ideas? Thanks a lot.

tony


From: Tony WONG on
after retest and retest, the form can be updated.

but i do not know why the form update with old value of textbox (me.load),
not the new value amended in the textbox

there is such statement at me.load
TxtPhone.Text = Dataset.Tables(0).Rows(0).Item(1).ToString

here is the button click event
Protected Sub BtnUpdate_Click(ByVal sender As Object, ByVal e As
EventArgs) Handles BtnUpdate.Click
Dim strUpdate As String
Dim cmdUpdate As SqlCommand
Dim SMSID As String = "95542"
myConnection.Open()
strUpdate = "Update oshc_out set Dest_Addr=(a)TxtPhone where SMS_ID='"
& SMSID & "'"
cmdUpdate = New SqlCommand(strUpdate, myConnection)
cmdUpdate.Parameters.AddWithValue("@TxtPhone", "852" +
TxtPhone.Text)
cmdUpdate.ExecuteNonQuery()
myConnection.Close()

End Sub

grateful for help!


From: Tony WONG on
fixed by change me.load to me.PreRender


"Tony WONG" <x34(a)netvigator.com> ���g��l��s�D:eNntCVq6KHA.3892(a)TK2MSFTNGP02.phx.gbl...
> after retest and retest, the form can be updated.
>
> but i do not know why the form update with old value of textbox (me.load),
> not the new value amended in the textbox
>
> there is such statement at me.load
> TxtPhone.Text = Dataset.Tables(0).Rows(0).Item(1).ToString
>
> here is the button click event
> Protected Sub BtnUpdate_Click(ByVal sender As Object, ByVal e As
> EventArgs) Handles BtnUpdate.Click
> Dim strUpdate As String
> Dim cmdUpdate As SqlCommand
> Dim SMSID As String = "95542"
> myConnection.Open()
> strUpdate = "Update oshc_out set Dest_Addr=(a)TxtPhone where
> SMS_ID='" & SMSID & "'"
> cmdUpdate = New SqlCommand(strUpdate, myConnection)
> cmdUpdate.Parameters.AddWithValue("@TxtPhone", "852" +
> TxtPhone.Text)
> cmdUpdate.ExecuteNonQuery()
> myConnection.Close()
>
> End Sub
>
> grateful for help!
>
>