--修改
create proc cp_update_role
(
@id int,
@name varchar(50),
@remark varchar(200)
)
as
update roles set name=@name,remark=@remark where id=@id
select * from roles
--删除
create proc cp_delete_role
(
@id int
)
as
delete roles where id=@id
--查询
create proc cp_select_role
(
@name varchar(50)
)
as
select * from roles where name like'%'+@name+'%'
2.查询方法
方式一
RbacDBEntities db = new RbacDBEntities();
//方式1 select
var roles1 = from r in db.Roles
where r.Name.Contains("主任")
select r;
方式二
var roles2 = db.Roles
.Where(p => p.Name.Contains("主任"))
.Select(p => p).ToList();