Free templates
Meny Search Free templates

UPDATE in a MySQL database (C#, VB and ASP.NET) | Free code

Here you can download free code (C# and VB) to refresh data (UPDATE) in a table in a MySQL database when you want to make it possible for you or your users to change data in a table.

Code for UPDATE in a MySQL database allows you to let users on your website to modify data in a web form on your site so that these changes also are updated in a MySQL database. UPDATE means to change or manipulate data for one or more records in tables that resides in a database.

This code to update data in a MySQL database is divided into two files, an aspx page that contains a web form to change user data on a website and a code page (C# or VB) that contains code for the SQL UPDATE statement. The web page for the web form is not connected to a "master page", a web project should contain a "master page" that is linked to CSS files so that it becomes easy to maintain the web design for the entire website.

Before you can update data in a MySQL database you must create a database, tables in the database and a named connection string to the database in the "Web.config" file. In this template we have created a connection string to a MySQL database that we named "ConnectionString" and it is this connection string that we make a reference to before we execute SQL statements.

When the web page for the web form is loaded we get data from a table in a MySQL database for the specific user by using a SELECT statement so that the user can see the information about the user that is stored in the database. The code for the UPDATE statement is executed when the user clicks on a button.

The code for UPDATE is surrounded by a "Try/Catch/Finally" block and this means that any errors in the code are handled by the web application, it is good to make sure that errors that can occur in the code not is handled by a web server that belongs to a web host.

Remember that you in your web hosting account must have made a setting for the correct version of the "ASP.NET" version for your website (the version listed in the file "Web.config"). We are using Visual Web Developer 2005 (2010) Express Edition for web programming.
Updated: 01-01-2015 | Created by

Download UPDATE in a MySQL database (C#, VB and ASP.NET) | Free code ยป

Tags: sql database code