CRUD Operations using Stored Procedure
I. Enter into Database
use Employee;
II.Create a StroredProcedure For CRUD Operations :
here we need to declare input parameter which we are passing with '@' prefix to variable .
Example: @Eid,@EName,@Dept,@Salary,@Action are input parameter.
create proc spCRUD
@Action varchar(50),
@Eid int ,
@EName varchar(50),
@Dept varchar(50),
@Salary int
III.Action to Display Details of tblEmployee
if @Action='Select'
begin
select * from tblemployee;
end
IV.Action to insert values in tblEmployee
if @Action='Insert'
begin
insert into tblemployee values(@Eid,@EName,@Dept,@Salary);
end
V. Action to Update in tblEmployee
if @Action='Update'
begin
update tblemployee set Eid=@Eid, Ename=@EName,Dept=@Dept,Salary=@Salary
where Eid=@Eid;
end
VI. Action to Delete in tblEmployee
if @Action='Delete'
begin
delete from tblemployee where Eid=@Eid;
end
Wooww Its !! very usefull ... Please keep updating the such posts. thanq
ReplyDeleteshow this crud operations in asp.net zaffar .. waiting for your next blog !!
ReplyDeleteThanks juned in response to your requested query
Deletecheck out this post http://maddotnetcoder.blogspot.in/2017/03/aspnet-gridview-crud-operations-insert.html
This is good article and i found one article for CRUD operations with stored procedure. i hope you like this.
ReplyDelete