I have an Access database and I want to fill some text boxes with data from a table. I'm using the following method for an example:
Me.txtCompany.Text = dr.GetString(1)
That works great. I have that in the PageLoad event.
Then I want a user to be able to change that value and submit it and have it update the database field.
So to do that, I have something like this:
strSQLCompany = "UPDATE Customers SET CompanyName='" & txtCompany.Text.Replace("'", "_") & "'"
This, however, doesn't work. It updates the database with the data that's entered into the text boxes on PageLoad instead of what's typed. I have the above code in my button click event.
I've tested my button click event by taking out the fill code in the PageLoad (making empty text boxes) and filling them in and submitting it and the correct information gets updated in the database, so I know that part of the code is correct.
Is there a reason why the button click event is taking the text from PageLoad instead of what's actually typed in the text box?