Database Storage with the ASP.NET Web Matrix: Update Page - Important Details and Updates
(Page 2 of 4 )
Some of these ID values may seem a little long, but whenever you find yourself application programming you should stick to the rule that anyone that hasn’t worked with you that has to debug your applications, should be able to do so easily and intuitively. All elements should be labelled according to their specific functions in a consistent way. If you looked at the code for an application for the first time that you were trying to update, and had a function that changed the value of a textbox, wouldn’t it be easier if you could pretty reliably guess what the textbox was called rather than figure out whether it’s textbox58 or not?
So anyway, your page should now look a little like this:

Now switch to the code view and drag an UPDATE onto the page. The UPDATE Data Code Wizard will open, and the database you are connected to will show. Click the Next button to move on to the Construct section. You need to tell it which column of the table you want to update; for this example, select the Password checkbox. You now need to construct the Where clause; click the WHERE button and make sure Username is highlighted, then click Ok.

Click the Next button twice and then give the function a name, such as updateUserPass and click Finish. Your code will be created and placed on the page.
To provide the visitor with a success message, find the Finally statement of the Try code block near the bottom of the function you just created and add the following line after the call to close the database connection:
lblSuccess.Text = "Password updated!"
Next: Calling the Function >>
More ASP.NET Articles
More By Dan Wellman