Free templates
Meny Search Free templates

UPDATE in a MS SQL 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 Microsoft SQL database when you want to make it possible for you or your users to change data in a table.

Code for UPDATE in a MS SQL 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 MS SQL 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 MS SQL 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 the 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 MS SQL 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 MS SQL 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 MS SQL database for the specific user by using a SELECT statement so that the user can see the information that is stored in the database about the user. The code for the UPDATE statement is executed when the user clicks 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 MS SQL database (C#, VB and ASP.NET) | Free code ยป

Tags: sql database code