Click to See Complete Forum and Search --> : textbox
jiahui84
12-11-2005, 08:46 PM
HI, see if anyone can help, I have assigned the value into a textbox while the page is loading. While loading, the user can edit the value in the textbox and click on the edit button. Instead of the edited value being placed into the database, it inserts the assign value.
Dim objReader As SqlClient.SqlDataReader
objReader = mycommand1.ExecuteReader()
objReader.Read()
Textbox3.Text = objReader("username")
takkie
12-13-2005, 02:02 PM
try to explain it more clearly...i dont understand what you are trying to do...
jiahui84
12-14-2005, 09:14 AM
Sorry for not being clear enough, what i am trying to ask is that i have a 'edit page' and when the user select the information that the user wanted to edit, the information will appear(which i have assigned the value into the textbox from the database) in the textbox on the edit page when the page is loading. Now i have a problem which is that after the user edit the information and click on the edit button, instead of storing the new information that the user have just enter, it store back the assign value(which is the old value). Hope that i have given a clear explanation
sirpelidor
12-14-2005, 01:01 PM
after the user edit the information and click on the edit button, instead of storing the new information that the user have just enter, it store back the assign value(which is the old value)
1) you sure when user click edit, the new value has been written to sql table succesfully?
2) whenever the page is loaded, you sure value is retrieved from sql table, and not some kindda cache value from last visit?
1 is more common problem then 2, u may wanna check that.
Cipher
12-14-2005, 05:16 PM
Try this
Dim objReader As SqlClient.SqlDataReader
objReader = mycommand1.ExecuteReader()
objReader.Read()
If Not IsPostBack Then
Textbox3.Text = objReader("username")
End If