Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mysticrenji/aspnetcore_ado
A sample project with ASPNETCore with ADO.NET
https://github.com/mysticrenji/aspnetcore_ado
Last synced: about 6 hours ago
JSON representation
A sample project with ASPNETCore with ADO.NET
- Host: GitHub
- URL: https://github.com/mysticrenji/aspnetcore_ado
- Owner: mysticrenji
- Created: 2018-03-24T10:52:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-17T00:33:57.000Z (over 3 years ago)
- Last Synced: 2023-03-04T23:48:15.770Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 1.03 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a sample project build with ASPNETCore 2.0 and ADO.NET
For this project to run need to Create a DB with below Table and procs
Creating Table and Stored Procedures
We will be using a DB table to store all the records of employees.Open SQL Server and use the following script to create tblEmployee table.
Create table tblEmployee(
EmployeeId int IDENTITY(1,1) NOT NULL,
Name varchar(20) NOT NULL,
City varchar(20) NOT NULL,
Department varchar(20) NOT NULL,
Gender varchar(6) NOT NULL
)
Now, we will create stored procedures to add, delete, update, and get employee data.---------------------------------------------------------------------------------------------
//To insert an Employee Record//
Create procedure spAddEmployee
(
@Name VARCHAR(20),
@City VARCHAR(20),
@Department VARCHAR(20),
@Gender VARCHAR(6)
)
as
Begin
Insert into tblEmployee (Name,City,Department, Gender)
Values (@Name,@City,@Department, @Gender)
End--------------------------------------------------------------------------------------------
//To update an Employee Record//
Create procedure spUpdateEmployee
(
@EmpId INTEGER ,
@Name VARCHAR(20),
@City VARCHAR(20),
@Department VARCHAR(20),
@Gender VARCHAR(6)
)
as
begin
Update tblEmployee
set Name=@Name,
City=@City,
Department=@Department,
Gender=@Gender
where EmployeeId=@EmpId
End-----------------------------------------------------------------------------------------------
//To delete an Employee Record//
Create procedure spDeleteEmployee
(
@EmpId int
)
as
begin
Delete from tblEmployee where EmployeeId=@EmpId
End----------------------------------------------------------------------------------------------
//To view all Employee Records//
Create procedure spGetAllEmployees
as
Begin
select *
from tblEmployee
order by EmployeeId
End