ASP.NET Core CRUD with SQL Server
Learn how to create an ASP.NET Core web app with SQL Server database and perform CRUD operations efficiently. 🚀

Manoj Deshwal
12.4K views • Nov 17, 2024

About this video
ASP.NET Core crud operation using sql server
Create ASP NET Core Web Application With SQL Server Database Connection and CRUD Operations
***************************
Create Your First ASP.NET Core Web Application with Database Integration. Connect an ASP.NET Core Web Application to a SQL Server Database.
Perform basic CRUD operations in ASP.NET Core. Add, View, Update, and Delete data in a SQL Server Database using an ASP.NET Core Web Application.
***************************
DBScript :
CREATE DATABASE [ProductManagementSystem_DB];
CREATE TABLE [dbo].[Products](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [nvarchar](255) NOT NULL,
[Address] [nvarchar](255) NULL,
[Country] [nvarchar](255) NOT NULL,
[State] [nvarchar](255) NOT NULL,
[City] [nvarchar](255) NOT NULL,
[ProductionDocument] [nvarchar](255) NULL,
[CraetedOn] [datetime] NULL);
CREATE PROCEDURE [dbo].[sp_DeleteProduct]
@Id INT
AS
BEGIN
DELETE FROM Products
WHERE Id = @Id;
END;
CREATE PROCEDURE [dbo].[sp_GetAllProducts]
AS
BEGIN
SELECT * FROM Products;
END;
CREATE PROCEDURE [dbo].[sp_GetProductById]
@Id INT
AS
BEGIN
SELECT * FROM Products
WHERE Id = @Id;
END;
CREATE PROCEDURE [dbo].[sp_InsertProduct]
@ProductName NVARCHAR(255),
@Address NVARCHAR(255) = NULL,
@Country NVARCHAR(255),
@State NVARCHAR(255),
@City NVARCHAR(255),
@ProductionDocument NVARCHAR(255) = NULL
AS
BEGIN
-- Check for duplicate ProductName
IF EXISTS (SELECT 1 FROM Products WHERE ProductName = @ProductName)
BEGIN
PRINT 'Duplicate ProductName exists';
RETURN;
END
INSERT INTO Products (ProductName, Address, Country, State, City, ProductionDocument)
VALUES (@ProductName, @Address, @Country, @State, @City, @ProductionDocument);
SELECT SCOPE_IDENTITY() AS NewProductId;
END;
CREATE PROCEDURE [dbo].[sp_UpdateProduct]
@Id INT,
@ProductName NVARCHAR(255),
@Address NVARCHAR(255) = NULL,
@Country NVARCHAR(255),
@State NVARCHAR(255),
@City NVARCHAR(255),
@ProductionDocument NVARCHAR(255) = NULL
AS
BEGIN
-- Check for duplicate ProductName excluding the current record
IF EXISTS (SELECT 1 FROM Products WHERE ProductName = @ProductName AND Id != @Id)
BEGIN
PRINT 'Duplicate ProductName exists';
RETURN;
END
UPDATE Products
SET ProductName = @ProductName,
Address = @Address,
Country = @Country,
State = @State,
City = @City,
ProductionDocument = @ProductionDocument,
CraetedOn = GETDATE()
WHERE Id = @Id;
END;
Tools Used: Visual Studio 2022 and SQL SERVER Management Studio
☕ Buy me a Coffee (Channel Support through Donation)
https://buymeacoffee.com/manojdeshwal
📻 Recommended Courses
➤ React Ecommerce Tutorial : https://www.youtube.com/playlist?list=PLXIf5ibIbJuwkwflqmcHpQOP5IpSjtsns
➤ React JS Tutorial : https://www.youtube.com/playlist?list=PLXIf5ibIbJuz_e3m6M2WMKrLUFIY2y23A
➤ React Router Tutorial : https://youtu.be/fDBD3E0zxTg
➤ Convert Html Template in Reactjs : https://youtu.be/oQXsSpuXUl4
➤ ASP.Net WEB API Tutorial : https://youtu.be/ouiHedLJjTs
➤ SQL SERVER Tutorial : https://youtu.be/cqgVxKdDq3Y
➤ HTML Crash Course: https://youtu.be/65qD_SaiKWA
➤ Payment Gateway Integration : https://youtu.be/CA2IR2AEN7I
➤ WEB API With SQL SERVER : https://youtu.be/ifgZdY3T0Gs
Subscribe to this channel
➤ https://bit.ly/2IaMZUr
Must buy Programming Laptops :
https://amzn.to/3AlLH03
https://amzn.to/3QQrgiz
https://amzn.to/3RaqBIQ
https://amzn.to/3R1EmJS
https://amzn.to/3QHU9gZ
https://amzn.to/3QNcAkk
https://amzn.to/3QKtzno
https://amzn.to/3dTMbmm
https://amzn.to/3dQJ7aG
Share, Support, Subscribe Now :
Youtube 🎥 : https://youtube.com/ManojDeshwal
Instagram 📷 : https://instagram.com/openprogrammer
Twitter 🐦 : https://twitter.com/openprogrammer
Facebook 👍 : https://facebook.com/openprogrammer
Website 🌐 : https://www.connectedprogrammer.com/
⭐️Tags : ⭐️
#dotnetcore
#netcorewebapi
#crudoperations
#dotnetcore #asp.netcore #.netcorewebapi #sqlserver #restapi
Thanks for watching. 😊😊 🙏🙏
Create ASP NET Core Web Application With SQL Server Database Connection and CRUD Operations
***************************
Create Your First ASP.NET Core Web Application with Database Integration. Connect an ASP.NET Core Web Application to a SQL Server Database.
Perform basic CRUD operations in ASP.NET Core. Add, View, Update, and Delete data in a SQL Server Database using an ASP.NET Core Web Application.
***************************
DBScript :
CREATE DATABASE [ProductManagementSystem_DB];
CREATE TABLE [dbo].[Products](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [nvarchar](255) NOT NULL,
[Address] [nvarchar](255) NULL,
[Country] [nvarchar](255) NOT NULL,
[State] [nvarchar](255) NOT NULL,
[City] [nvarchar](255) NOT NULL,
[ProductionDocument] [nvarchar](255) NULL,
[CraetedOn] [datetime] NULL);
CREATE PROCEDURE [dbo].[sp_DeleteProduct]
@Id INT
AS
BEGIN
DELETE FROM Products
WHERE Id = @Id;
END;
CREATE PROCEDURE [dbo].[sp_GetAllProducts]
AS
BEGIN
SELECT * FROM Products;
END;
CREATE PROCEDURE [dbo].[sp_GetProductById]
@Id INT
AS
BEGIN
SELECT * FROM Products
WHERE Id = @Id;
END;
CREATE PROCEDURE [dbo].[sp_InsertProduct]
@ProductName NVARCHAR(255),
@Address NVARCHAR(255) = NULL,
@Country NVARCHAR(255),
@State NVARCHAR(255),
@City NVARCHAR(255),
@ProductionDocument NVARCHAR(255) = NULL
AS
BEGIN
-- Check for duplicate ProductName
IF EXISTS (SELECT 1 FROM Products WHERE ProductName = @ProductName)
BEGIN
PRINT 'Duplicate ProductName exists';
RETURN;
END
INSERT INTO Products (ProductName, Address, Country, State, City, ProductionDocument)
VALUES (@ProductName, @Address, @Country, @State, @City, @ProductionDocument);
SELECT SCOPE_IDENTITY() AS NewProductId;
END;
CREATE PROCEDURE [dbo].[sp_UpdateProduct]
@Id INT,
@ProductName NVARCHAR(255),
@Address NVARCHAR(255) = NULL,
@Country NVARCHAR(255),
@State NVARCHAR(255),
@City NVARCHAR(255),
@ProductionDocument NVARCHAR(255) = NULL
AS
BEGIN
-- Check for duplicate ProductName excluding the current record
IF EXISTS (SELECT 1 FROM Products WHERE ProductName = @ProductName AND Id != @Id)
BEGIN
PRINT 'Duplicate ProductName exists';
RETURN;
END
UPDATE Products
SET ProductName = @ProductName,
Address = @Address,
Country = @Country,
State = @State,
City = @City,
ProductionDocument = @ProductionDocument,
CraetedOn = GETDATE()
WHERE Id = @Id;
END;
Tools Used: Visual Studio 2022 and SQL SERVER Management Studio
☕ Buy me a Coffee (Channel Support through Donation)
https://buymeacoffee.com/manojdeshwal
📻 Recommended Courses
➤ React Ecommerce Tutorial : https://www.youtube.com/playlist?list=PLXIf5ibIbJuwkwflqmcHpQOP5IpSjtsns
➤ React JS Tutorial : https://www.youtube.com/playlist?list=PLXIf5ibIbJuz_e3m6M2WMKrLUFIY2y23A
➤ React Router Tutorial : https://youtu.be/fDBD3E0zxTg
➤ Convert Html Template in Reactjs : https://youtu.be/oQXsSpuXUl4
➤ ASP.Net WEB API Tutorial : https://youtu.be/ouiHedLJjTs
➤ SQL SERVER Tutorial : https://youtu.be/cqgVxKdDq3Y
➤ HTML Crash Course: https://youtu.be/65qD_SaiKWA
➤ Payment Gateway Integration : https://youtu.be/CA2IR2AEN7I
➤ WEB API With SQL SERVER : https://youtu.be/ifgZdY3T0Gs
Subscribe to this channel
➤ https://bit.ly/2IaMZUr
Must buy Programming Laptops :
https://amzn.to/3AlLH03
https://amzn.to/3QQrgiz
https://amzn.to/3RaqBIQ
https://amzn.to/3R1EmJS
https://amzn.to/3QHU9gZ
https://amzn.to/3QNcAkk
https://amzn.to/3QKtzno
https://amzn.to/3dTMbmm
https://amzn.to/3dQJ7aG
Share, Support, Subscribe Now :
Youtube 🎥 : https://youtube.com/ManojDeshwal
Instagram 📷 : https://instagram.com/openprogrammer
Twitter 🐦 : https://twitter.com/openprogrammer
Facebook 👍 : https://facebook.com/openprogrammer
Website 🌐 : https://www.connectedprogrammer.com/
⭐️Tags : ⭐️
#dotnetcore
#netcorewebapi
#crudoperations
#dotnetcore #asp.netcore #.netcorewebapi #sqlserver #restapi
Thanks for watching. 😊😊 🙏🙏
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
12.4K
Likes
172
Duration
01:11:43
Published
Nov 17, 2024
User Reviews
4.5
(2) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends