This tutorial will show how we can use Stored Procedures instead of explicit SQL statements to add data from a form to a database. C# version.

Using Stored Procedures instead of specific SQL statements is very useful – one Stored Procedure can be referenced many times by many different pages, and changes only need to be made once, for example. Using Stored Procedures is barely more difficult to implement than using SQL statements in code.
First, we need the following assembly reference:

In our Web.config, we declare the connection string:

The ASPX page will look something like this:

The Stored Procedure will look something like this:

The code-behind will look something like this:

Download Source Files