Duration: 18 minutes
Summary: Now we are in the update item dialog. The row that needs to be updated has been passed into this dialog. We have the option of indicating that the item has been sold and the date it was sold. Through the checkbox, we show/hide the sold date based on user’s selection.
When the user submits the changes, we first confirm that all the controls have the valid data. If that is the case, then we submit the changes to the database. The submit steps include creating the command object, setting up the formatted SQL statement, reading the connection string, opening a connection, executing the update, closing the connection, and finally, informing the user that the update has happened. All this is in a try/catch block so we can report any error message that happens during the update.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: Windows Applications and Visual Studio 2010
Keyword: Visual Studio 2010, Windows Controls, MessageBox, Show, CheckBox, Checked, Visible, sqlCommand, DateTime?, Parse, ConfigurationManager, SqlConnection, Open, Exception, Close, Message.