Insert data into a database table using ASP.Net, C# and Microsoft SQL Server Stored Procedure

Introduction:

Dear learners,
Today, I am going to share with you a complete project information. Which is developed with ASP.NET, C# and Microsoft SQL Server. This project codes is open for all. It's mean you will be able to apply all codes in your software development. It is a very beginner level tutorial, anyone can get benefit from this tutorial. It's a very lightweight tutorial for all. If you are a new coder or even you haven't written a single bit of code in the ASP.NET development environment, no worries. Must you will get benefit from this lesson. Just follow the following instructions. 

📌 ASP.NET

Figure : Solution Explorer

📍 Microsoft SQL Server

➤ Open or launch Microsoft SQL Server Management Studio
➤ Create a Database or DB.
➤ Create a Table.
➤ Create Stored Procedure.
Such as:
Step - 01: Open Microsoft SQL Server Management Studio



Microsoft SQL Server Management Studio has been opened. Now, follow the following steps to create your desired Database 

Step - 02: Create Database or DB









Just now, you have completed the Database creation procedure. Now you have a DB and it's name is ASPCRUD. Please, follow the following instructions to create a table 

Step - 03: Create a Table















Thank you! You have created empty table. Please, follow the following instructions to create stored procedure ↴

Step - 04: Create Stored Procedure
















Well done! You have created Stored Procedure. Now, follow the following instructions to complete your project 

📍 HTML

➤ Open or launch Microsoft Visual Studio.
➤ Create a new and empty project with Web Forms.
➤ Create a web form and give a name for it (any name, as you wish). 
Such as:
initial-contact.aspx 
or
contact.aspx 

🖈 initial-contact.aspx 

After creating 'initial-contact.aspx' web form in ASP.NET past the following code:

initial-contact.aspx page source code:


Figure : initial-contact.aspx page source code view
Figure : initial-contact.aspx page design view
Figure : initial-contact.aspx page split view

📍 C#

🖈  initial-contact.aspx.cs

After completing HTML part open 'initial-contact.aspx.cs' window in Microsoft Visual Studio.

initial-contact.aspx.cs page source code:


Figure : initial-contact.aspx.cs c# code view

DB or Database Connection C# source code (initial-contact.aspx.cs):

Save Button C# source code (initial-contact.aspx.cs):


📍 Output


Step - 01 : Web browser output is following




Step - 02 : Microsoft SQL Server Management Studio output is following


I hope this article will be helpful for your work.
Thank you!

Comments

Popular posts from this blog

CRUD Operation - ASP.NET Core MVC with EF Core

Forward to 404 page for all missing URL - ASP.NET