Simple Login Project using Stored Procedures in ASP.NET: Part 1


After reviewing the huge responses and visits from one of my articles titled "Simple Login Project in ASP.NET", I decided to convert this to use a stored procedure too. Now, by using this article a user will accelerate or speed-up his login. I am assuming you are already familiar with stored procedures. I am adding some more new stuff in my previous article (look on above URL), so I will recommend that you read that before getting started here. All the basics like database designing, form designing and configuration settings are not discussed here. Let's look at some advantages of using stored procedures.

Advantages of Stored Procedures

Enhanced Security

Instead of writing our SQL queries in code-behind, we can write and store it in the database server instead of file server. This process will add more security for our applications.

Precompiled Execution

SQL Server compiles each stored procedure once and then reutilizes the execution plan. This results in tremendous performance boosts when stored procedures are called repeatedly.

Reduced client/server Traffic

If network bandwidth is a concern in your environment, you'll be happy to learn that stored procedures can reduce long SQL queries to a single line that is transmitted over the wire.

Efficient reuse of code and programming abstraction

Stored procedures can be used by multiple users and client programs. If you utilize them in a planned manner, you'll find the development cycle takes less time.

Creating Stored Procedures


In the above image, I have created three stored procedures:

(i) CheckUser

This procedure will ask for two values, username and password and search the existence of matched username and password. This procedure will be called from login page.

(ii) CheckUsernameExistance

This procedure will ask for the single value of username and check for it in the database; if no such username exists then it will be used for a new user account. This procedure will be called from the new account registration page.

(iii) CreateNewUser

This procedure will ask for four values, fullname, username, password and emailid of user and creates a new user account. This procedure will be called from the new account registration page.

Find more explanation in next post.


Similar Articles