Page_Load() fires prior to button events.
Make sure you are setting the value only when IsPostBack() is false. If not,
you are setting the value again prior to saving, thus saving the original
value.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************************************************
Think Outside the Box!
*************************************************
"Toni" <> wrote in message
news:uHfoF$...
> Hello! I'm building an application where the user can update his own
> personal information in a database using a form. The program fetches the
> user's information from the database, fills the form with this
> information, then the user makes the changes that he wants, clicks the
> "Update" button and the updated information is sent back to the database.
> But I have a problem. My program is supposed to work like this:
>
> txtNamefield.text = "John Smith"
> - a text field is filled with old information fetched from the database
> - the user changes this name, and clicks "Update"
>
> Dim name as String
> name = txtNamefield.text
> Dim Sqlsentence as string
> Sqlsentence = "UPDATE tableUser SET NAME = '" & name & "' WHERE
> USERID=XXX;"
> - the value of the text field is read to the variable "name" and the
> Sqlsentence is executed.
>
> But the value sent to the database is still the same old value, "John
> Smith", even though the user changed it and it vas read to the variable
> "name".
>
> If I don't fill the textfields in advance the program reads the values
> correctly. I would be very happy if someone could let me know what I'm
> doing wrong. Thank you very much in advance!
>
> Toni S.
>
|