Last post Jun 16, 2010 01:59 PM by raghav_khunger
Jun 16, 2010 01:23 PM|GuyCre8ive|LINK
I'm trying to update a record by using the following code but it's not updating it, the value stays the original database value. Anyone have a clue why? I'm stumped and tired as hell so I'm sure this is easy but it's not coming to me right now:
If Not IsDBNull(dr("custname")) Then
nameTB1.Text = dr("custname")
SET [custname] = '" & nameTB1.Text & "'
Jun 16, 2010 01:47 PM|ecbruck|LINK
I'm not sure if this is your problem, but one of the most common causes of this problem is that the data is being loaded into your TextBox each and every postback instead of just on the initial page load. Make sure that you are only loading your data within
a Not IsPostBack clause.
Jun 16, 2010 01:53 PM|GuyCre8ive|LINK
LOL, that did it. I can't believe I missed that, I've used this code several other places and just kept overlooking that part. Thought maybe it was .NET 4 that I just upgraded. Thanks so much..
Jun 16, 2010 01:59 PM|raghav_khunger|LINK
Ecbruck is right. Yes I have seen this type of issue many times and programmers miss the IsPostback check at the page load while applying their logic at the page load. For IsPostback you can refer http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx